Patch 8.2.0946

7 views
Skip to first unread message

Bram Moolenaar

unread,
Jun 10, 2020, 9:46:37 AM6/10/20
to vim...@googlegroups.com

Patch 8.2.0946
Problem: Cannot use "q" to cancel a number prompt.
Solution: Recognize "q" instead of ignoring it.
Files: src/misc1.c, src/testdir/test_functions.vim


*** ../vim-8.2.0945/src/misc1.c 2020-05-10 14:13:58.859609394 +0200
--- src/misc1.c 2020-06-10 15:38:12.466400710 +0200
***************
*** 945,951 ****
do_redraw = FALSE;
break;
}
! else if (c == CAR || c == NL || c == Ctrl_C || c == ESC)
break;
}
--no_mapping;
--- 945,951 ----
do_redraw = FALSE;
break;
}
! else if (c == CAR || c == NL || c == Ctrl_C || c == ESC || c == 'q')
break;
}
--no_mapping;
***************
*** 967,975 ****

// When using ":silent" assume that <CR> was entered.
if (mouse_used != NULL)
! msg_puts(_("Type number and <Enter> or click with mouse (empty cancels): "));
else
! msg_puts(_("Type number and <Enter> (empty cancels): "));

// Set the state such that text can be selected/copied/pasted and we still
// get mouse events. redraw_after_callback() will not redraw if cmdline_row
--- 967,975 ----

// When using ":silent" assume that <CR> was entered.
if (mouse_used != NULL)
! msg_puts(_("Type number and <Enter> or click with the mouse (q or empty cancels): "));
else
! msg_puts(_("Type number and <Enter> (q or empty cancels): "));

// Set the state such that text can be selected/copied/pasted and we still
// get mouse events. redraw_after_callback() will not redraw if cmdline_row
*** ../vim-8.2.0945/src/testdir/test_functions.vim 2020-06-02 22:19:45.310490731 +0200
--- src/testdir/test_functions.vim 2020-06-10 15:41:16.697780183 +0200
***************
*** 1371,1376 ****
--- 1371,1388 ----
call feedkeys(":let c = inputlist(['Select color:', '1. red', '2. green', '3. blue'])\<cr>3\<cr>", 'tx')
call assert_equal(3, c)

+ " CR to cancel
+ call feedkeys(":let c = inputlist(['Select color:', '1. red', '2. green', '3. blue'])\<cr>\<cr>", 'tx')
+ call assert_equal(0, c)
+
+ " Esc to cancel
+ call feedkeys(":let c = inputlist(['Select color:', '1. red', '2. green', '3. blue'])\<cr>\<Esc>", 'tx')
+ call assert_equal(0, c)
+
+ " q to cancel
+ call feedkeys(":let c = inputlist(['Select color:', '1. red', '2. green', '3. blue'])\<cr>q", '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)
*** ../vim-8.2.0945/src/version.c 2020-06-10 15:32:04.455653633 +0200
--- src/version.c 2020-06-10 15:45:23.312953579 +0200
***************
*** 756,757 ****
--- 756,759 ----
{ /* Add new patch number below this line */
+ /**/
+ 946,
/**/

--
Q: How does a UNIX Guru do Sex ?
A: unzip;strip;touch;finger;mount;fsck;more;yes;umount;sleep

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages