Skip to content

Commit fc056f3

Browse files
committed
fix empty input
ref: #265 (comment)
1 parent fc7d1d9 commit fc056f3

File tree

2 files changed

+9
-17
lines changed

2 files changed

+9
-17
lines changed

autoload/EasyMotion.vim

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,9 @@ endfunction " }}}
141141
function! EasyMotion#OverwinF(num_strokes) " {{{
142142
let re = s:findMotion(a:num_strokes, s:DIRECTION.bidirection)
143143
call EasyMotion#reset()
144-
return EasyMotion#overwin#move(re)
144+
if re isnot# ''
145+
return EasyMotion#overwin#move(re)
146+
endif
145147
endfunction "}}}
146148
function! EasyMotion#T(num_strokes, visualmode, direction) " {{{
147149
if a:direction == 1

autoload/vital/_easymotion/HitAHint/Motion.vim

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ function! s:_vital_loaded(V) abort
44
let s:Buffer = a:V.import('Vim.Buffer')
55
let s:Prelude = a:V.import('Prelude')
66
let s:Set = a:V.import('Data.Set')
7+
let s:Input = a:V.import('Over.Input')
78
endfunction
89

910
function! s:_vital_depends() abort
@@ -13,6 +14,7 @@ function! s:_vital_depends() abort
1314
\ 'Vim.Buffer',
1415
\ 'Prelude',
1516
\ 'Data.Set',
17+
\ 'Over.Input',
1618
\ ]
1719
endfunction
1820

@@ -45,16 +47,16 @@ endfunction
4547

4648
function! s:move_f(...) abort
4749
echo 'Target: '
48-
let c = s:getchar()
50+
let c = s:Input.getchar()
4951
return s:move(c, get(a:, 1, {}))
5052
endfunction
5153

5254
function! s:move_f2() abort
5355
echo 'Target: '
54-
let c = s:getchar()
56+
let c = s:Input.getchar()
5557
redraw
5658
echo 'Target: ' . c
57-
let c2 = s:getchar()
59+
let c2 = s:Input.getchar()
5860
return s:move(s:Prelude.escape_pattern(c . c2), get(a:, 1, {}))
5961
endfunction
6062

@@ -219,7 +221,7 @@ function! s:overwin.choose_prompt(hint_dict) abort
219221
call hinter.show_hint()
220222
redraw
221223
echo 'Target key: '
222-
let c = s:getchar()
224+
let c = s:Input.getchar()
223225
if self.config.use_upper
224226
let c = toupper(c)
225227
endif
@@ -734,18 +736,6 @@ function! s:is_in_fold(lnum) abort
734736
return foldclosed(a:lnum) != -1
735737
endfunction
736738

737-
function! s:getchar(...) abort
738-
let mode = get(a:, 1, 0)
739-
while 1
740-
let char = call('getchar', a:000)
741-
" Workaround for the <expr> mappings
742-
if string(char) !~# "\x80\xfd`"
743-
return mode == 1 ? !!char
744-
\ : type(char) == type(0) ? nr2char(char) : char
745-
endif
746-
endwhile
747-
endfunction
748-
749739
" @param {funcref} func
750740
" @param {arglist} list<S>
751741
" @param {dict?} dict for :h call()

0 commit comments

Comments
 (0)