summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author=?UTF-8?q?Luka=20Marku=C5=A1i=C4=87?= <luka.markusic@microblink.com>2021-05-20 21:14:20 +0200
committerBram Moolenaar <Bram@vim.org>2021-05-20 21:14:20 +0200
commit5cf94577cf2045fec87344d7d89422fe6dfce62f (patch)
treedf93f456dada232ba7dfaaf02171cc8b6eded4d5
parent4eb1914e1bd870a7ea829cae150e1f9fdc3df7b1 (diff)
patch 8.2.2875: cancelling inputlist() after a digit does not return zerov8.2.2875
Problem: Cancelling inputlist() after a digit does not return zero. Solution: Always return zero when cancelling. (closes #8231)
-rw-r--r--src/misc1.c7
-rw-r--r--src/testdir/test_functions.vim4
-rw-r--r--src/version.c2
3 files changed, 12 insertions, 1 deletions
diff --git a/src/misc1.c b/src/misc1.c
index a72dc9bf21..7cac06b926 100644
--- a/src/misc1.c
+++ b/src/misc1.c
@@ -946,7 +946,12 @@ get_number(
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;
}
--no_mapping;
diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim
index 96cf16ce46..b4d462b86c 100644
--- a/src/testdir/test_functions.vim
+++ b/src/testdir/test_functions.vim
@@ -1480,6 +1480,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)
+
" Use backspace to delete characters in the prompt
call feedkeys(":let c = inputlist(['Select color:', '1. red', '2. green', '3. blue'])\<cr>1\<BS>3\<BS>2\<cr>", 'tx')
call assert_equal(2, c)
diff --git a/src/version.c b/src/version.c
index 7f163f8a3c..d593a22073 100644
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 2875,
+/**/
2874,
/**/
2873,