Skip to content

Commit b255eee

Browse files
committed
🐛 Fix helper/input cancellation on Vim
Fix `helper/input` does not return `null` on <ESC>/<C-c> if the cursor is not at the end of line on Vim.
1 parent ec2d3ab commit b255eee

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

helper/input.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ async function ensurePrerequisites(denops: Denops): Promise<string> {
7171
function! s:input_${suffix}(prompt, text, completion) abort
7272
let originalEsc = maparg('<Esc>', 'c', 0, 1)
7373
let originalInt = maparg('<C-c>', 'c', 0, 1)
74-
execute printf('cnoremap <nowait><buffer> <Esc> <C-u>%s<CR>', s:escape_token_${suffix})
75-
execute printf('cnoremap <nowait><buffer> <C-c> <C-u>%s<CR>', s:escape_token_${suffix})
74+
execute printf('cnoremap <nowait><buffer> <Esc> <C-e><C-u>%s<CR>', s:escape_token_${suffix})
75+
execute printf('cnoremap <nowait><buffer> <C-c> <C-e><C-u>%s<CR>', s:escape_token_${suffix})
7676
try
7777
let result = a:completion is# v:null
7878
\\ ? input(a:prompt, a:text)

helper/input_test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ test({
135135
helper.define(
136136
"CmdlineEnter",
137137
"*",
138-
`call feedkeys("Hello world!\\<Esc>", "it")`,
138+
`call feedkeys("Hello world!\\<Left>\\<Esc>", "it")`,
139139
);
140140
});
141141
const result = await input(denops);
@@ -150,7 +150,7 @@ test({
150150
helper.define(
151151
"CmdlineEnter",
152152
"*",
153-
`call feedkeys("Hello world!\\<C-c>", "it")`,
153+
`call feedkeys("Hello world!\\<Left>\\<C-c>", "it")`,
154154
);
155155
});
156156
const result = await input(denops);

0 commit comments

Comments
 (0)