do_redraw = FALSE;
break;
}
- else if (c == CAR || c == NL || c == Ctrl_C || c == ESC)
+ else if (c == CAR || c == NL || c == Ctrl_C || c == ESC || c == 'q')
break;
}
--no_mapping;
// When using ":silent" assume that <CR> was entered.
if (mouse_used != NULL)
- msg_puts(_("Type number and <Enter> or click with mouse (empty cancels): "));
+ msg_puts(_("Type number and <Enter> or click with the mouse (q or empty cancels): "));
else
- msg_puts(_("Type number and <Enter> (empty cancels): "));
+ 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
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)