Skip to content

Commit 7de3ced

Browse files
authored
Merge pull request #82 from vim-denops/fix-input
🐛 Do NOT use temporary buffer in `input()` on Vim
2 parents 5c716ef + 4f047fa commit 7de3ced

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

denops_std/helper/input.vim

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,20 +50,25 @@ if has('nvim')
5050
endfunction
5151
else
5252
function! s:input(prompt, text, completion) abort
53-
keepjumps keepalt botright 0new
53+
let original = maparg('<Esc>', 'n')
5454
execute printf('cnoremap <nowait><buffer> <Esc> <C-u>%s<CR>', s:escape_token)
5555
try
5656
let result = a:completion is# v:null
5757
\ ? input(a:prompt, a:text)
5858
\ : input(a:prompt, a:text, a:completion)
59+
redraw | echo ""
5960
if result ==# s:escape_token
6061
return v:null
6162
endif
6263
return result
6364
catch /^Vim:Interrupt$/
6465
return v:null
6566
finally
66-
bwipeout!
67+
if empty(original)
68+
cunmap <buffer> <Esc>
69+
else
70+
execute printf('cmap <buffer> %s', original)
71+
endif
6772
endtry
6873
endfunction
6974
endif

0 commit comments

Comments
 (0)