From 799491e007515890aff363b6eac5dbc9c5aa7f80 Mon Sep 17 00:00:00 2001 From: haya14busa Date: Fri, 22 Jan 2016 09:12:33 +0900 Subject: [PATCH] Fix #237 --- autoload/EasyMotion.vim | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/autoload/EasyMotion.vim b/autoload/EasyMotion.vim index 97a0dc3..3273db3 100644 --- a/autoload/EasyMotion.vim +++ b/autoload/EasyMotion.vim @@ -471,16 +471,28 @@ function! s:SetLines(lines, key) " {{{ endfunction " }}} " -- Get characters from user input ------ -function! s:GetChar() " {{{ - let char = getchar() - if char == 27 || char == 3 - " Escape or key pressed - redraw - call s:Message('Cancelled') - return '' - endif - return nr2char(char) -endfunction " }}} +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 " + endtry + if char == 27 || char == 3 + " Escape or key pressed + redraw + call s:Message('Cancelled') + return '' + endif + " Workaround for the 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) "{{{