vim-patch:8.2.0946: cannot use "q" to cancel a number prompt

Problem:    Cannot use "q" to cancel a number prompt.
Solution:   Recognize "q" instead of ignoring it.
eebd555733
This commit is contained in:
Jan Edmund Lazo
2021-05-20 21:14:59 -04:00
parent 4dadbe64a0
commit 39fdb86832
4 changed files with 24 additions and 9 deletions

View File

@@ -753,8 +753,9 @@ get_number (
skip_redraw = TRUE; /* skip redraw once */
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--;
return n;
@@ -771,11 +772,13 @@ int prompt_for_number(int *mouse_used)
int save_cmdline_row;
int save_State;
/* 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): "));
// 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. */