mirror of
https://github.com/neovim/neovim.git
synced 2025-09-28 14:08:32 +00:00
vim-patch:8.2.2875: cancelling inputlist() after a digit does not return zero
Problem: Cancelling inputlist() after a digit does not return zero.
Solution: Always return zero when cancelling. (closes vim/vim#8231)
5cf94577cf
This commit is contained in:
@@ -753,7 +753,10 @@ get_number (
|
|||||||
skip_redraw = TRUE; /* skip redraw once */
|
skip_redraw = TRUE; /* skip redraw once */
|
||||||
do_redraw = FALSE;
|
do_redraw = FALSE;
|
||||||
break;
|
break;
|
||||||
} else if (c == CAR || c == NL || c == Ctrl_C || c == ESC || c == 'q') {
|
} else if (c == Ctrl_C || c == ESC || c == 'q') {
|
||||||
|
n = 0;
|
||||||
|
break;
|
||||||
|
} else if (c == CAR || c == NL) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1079,6 +1079,10 @@ func Test_inputlist()
|
|||||||
call feedkeys(":let c = inputlist(['Select color:', '1. red', '2. green', '3. blue'])\<cr>q", 'tx')
|
call feedkeys(":let c = inputlist(['Select color:', '1. red', '2. green', '3. blue'])\<cr>q", 'tx')
|
||||||
call assert_equal(0, c)
|
call assert_equal(0, c)
|
||||||
|
|
||||||
|
" Cancel after inputting a number
|
||||||
|
call feedkeys(":let c = inputlist(['Select color:', '1. red', '2. green', '3. blue'])\<cr>5q", 'tx')
|
||||||
|
call assert_equal(0, c)
|
||||||
|
|
||||||
call assert_fails('call inputlist("")', 'E686:')
|
call assert_fails('call inputlist("")', 'E686:')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user