Skip to content

Commit c8676e0

Browse files
committed
Cancel 'zoom' when user hit 'Escape'
1 parent e9717de commit c8676e0

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

autoload/fern/mapping/drawer.vim

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ function! s:map_zoom(helper) abort
2626
if alpha <= 0 || alpha > 10
2727
let current = float2nr(ceil(str2float(winwidth(0)) / &columns * 10))
2828
let alpha = s:input_alpha(printf('Width ratio [%d -> 1-10]: ', current))
29+
if alpha is# v:null
30+
return
31+
endif
2932
endif
3033
let alpha = str2float(alpha)
3134
let width = &columns * (alpha / 10)
@@ -43,7 +46,10 @@ endfunction
4346
function! s:input_alpha(prompt) abort
4447
while v:true
4548
let result = input(a:prompt)
46-
if result =~# '^\%(10\|[1-9]\)$'
49+
if result ==# ''
50+
redraw | echo ''
51+
return v:null
52+
elseif result =~# '^\%(10\|[1-9]\)$'
4753
redraw | echo ''
4854
return result
4955
endif

0 commit comments

Comments
 (0)