diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2021-05-20 21:21:29 -0400 |
---|---|---|
committer | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2021-05-21 23:01:11 -0400 |
commit | 486050ebc94d125b6a30340ec595ef62956624a7 (patch) | |
tree | f600e2fa5888e5273aa6a7ef69e09cf407a1755f /src | |
parent | 39fdb868322fe32f2dcc7187b6f2f698e24b93f8 (diff) | |
download | rneovim-486050ebc94d125b6a30340ec595ef62956624a7.tar.gz rneovim-486050ebc94d125b6a30340ec595ef62956624a7.tar.bz2 rneovim-486050ebc94d125b6a30340ec595ef62956624a7.zip |
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)
https://github.com/vim/vim/commit/5cf94577cf2045fec87344d7d89422fe6dfce62f
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/misc1.c | 5 | ||||
-rw-r--r-- | src/nvim/testdir/test_functions.vim | 4 |
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 |