This commit is contained in:
haya14busa 2016-01-22 09:12:33 +09:00
parent d00540912c
commit 799491e007

View File

@ -471,16 +471,28 @@ function! s:SetLines(lines, key) " {{{
endfunction " }}}
" -- Get characters from user input ------
function! s:GetChar() " {{{
let char = getchar()
function! s:GetChar(...) abort "{{{
let mode = get(a:, 1, 0)
while 1
" Workaround for https://github.com/osyo-manga/vital-over/issues/53
try
let char = call('getchar', a:000)
catch /^Vim:Interrupt$/
let char = 3 " <C-c>
endtry
if char == 27 || char == 3
" Escape or <C-c> key pressed
redraw
call s:Message('Cancelled')
return ''
endif
return nr2char(char)
endfunction " }}}
" Workaround for the <expr> mappings
if string(char) !=# "\x80\xfd`"
return mode == 1 ? !!char
\ : type(char) == type(0) ? nr2char(char) : char
endif
endwhile
endfunction "}}}
" -- Find Motion Helper ------------------
function! s:findMotion(num_strokes, direction) "{{{