To: vim_dev@googlegroups.com Subject: Patch 8.2.2875 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.2875 Problem: Cancelling inputlist() after a digit does not return zero. Solution: Always return zero when cancelling. (closes #8231) Files: src/misc1.c, src/testdir/test_functions.vim *** ../vim-8.2.2874/src/misc1.c 2021-02-15 20:37:58.457374538 +0100 --- src/misc1.c 2021-05-20 21:08:55.904522855 +0200 *************** *** 946,952 **** do_redraw = FALSE; break; } ! else if (c == CAR || c == NL || c == Ctrl_C || c == ESC || c == 'q') break; } --no_mapping; --- 946,957 ---- do_redraw = FALSE; break; } ! else if (c == Ctrl_C || c == ESC || c == 'q') ! { ! n = 0; ! break; ! } ! else if (c == CAR || c == NL ) break; } --no_mapping; *** ../vim-8.2.2874/src/testdir/test_functions.vim 2021-05-19 17:15:00.825866111 +0200 --- src/testdir/test_functions.vim 2021-05-20 21:08:55.904522855 +0200 *************** *** 1480,1485 **** --- 1480,1489 ---- call feedkeys(":let c = inputlist(['Select color:', '1. red', '2. green', '3. blue'])\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'])\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'])\1\3\2\", 'tx') call assert_equal(2, c) *** ../vim-8.2.2874/src/version.c 2021-05-20 11:54:07.229060243 +0200 --- src/version.c 2021-05-20 21:11:12.411869452 +0200 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 2875, /**/ -- 'I generally avoid temptation unless I can't resist it." -- Mae West /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///