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 " }}} endfunction " }}}
" -- Get characters from user input ------ " -- Get characters from user input ------
function! s:GetChar() " {{{ function! s:GetChar(...) abort "{{{
let char = getchar() 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 if char == 27 || char == 3
" Escape or <C-c> key pressed " Escape or <C-c> key pressed
redraw redraw
call s:Message('Cancelled') call s:Message('Cancelled')
return '' return ''
endif endif
return nr2char(char) " Workaround for the <expr> mappings
endfunction " }}} if string(char) !=# "\x80\xfd`"
return mode == 1 ? !!char
\ : type(char) == type(0) ? nr2char(char) : char
endif
endwhile
endfunction "}}}
" -- Find Motion Helper ------------------ " -- Find Motion Helper ------------------
function! s:findMotion(num_strokes, direction) "{{{ function! s:findMotion(num_strokes, direction) "{{{