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 #8231)
diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim
index 96cf16c..b4d462b 100644
--- a/src/testdir/test_functions.vim
+++ b/src/testdir/test_functions.vim
@@ -1480,6 +1480,10 @@
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)