aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/misc1.c5
-rw-r--r--src/nvim/testdir/test_functions.vim4
2 files changed, 8 insertions, 1 deletions
diff --git a/src/nvim/misc1.c b/src/nvim/misc1.c
index 795af3d94a..38d0a7dadf 100644
--- a/src/nvim/misc1.c
+++ b/src/nvim/misc1.c
@@ -753,7 +753,10 @@ get_number (
skip_redraw = TRUE; /* skip redraw once */
do_redraw = FALSE;
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;
}
}
diff --git a/src/nvim/testdir/test_functions.vim b/src/nvim/testdir/test_functions.vim
index b81dce9940..85d1bc7076 100644
--- a/src/nvim/testdir/test_functions.vim
+++ b/src/nvim/testdir/test_functions.vim
@@ -1079,6 +1079,10 @@ func Test_inputlist()
call feedkeys(":let c = inputlist(['Select color:', '1. red', '2. green', '3. blue'])\<cr>q", 'tx')
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:')
endfunc