rcfile: allow to rebind the Cancel function in the yesno menu

This fixes the first part of https://savannah.gnu.org/bugs/?54447.
master
Benno Schulenberg 2018-08-05 20:01:47 +02:00
parent 4170454837
commit 418bd3be34
4 changed files with 11 additions and 1 deletions

View File

@ -1441,6 +1441,9 @@ The 'search to replace' menu.
@item replacewith @item replacewith
The 'replace with' menu, which comes up after 'search to replace'. The 'replace with' menu, which comes up after 'search to replace'.
@item yesno
The 'yesno' menu, where the Yes/No/All/Cancel question is asked.
@item gotoline @item gotoline
The 'goto line (and column)' menu. The 'goto line (and column)' menu.

View File

@ -792,6 +792,9 @@ The 'search to replace' menu.
.B replacewith .B replacewith
The 'replace with' menu, which comes up after 'search to replace'. The 'replace with' menu, which comes up after 'search to replace'.
.TP .TP
.B yesno
The 'yesno' menu, where the Yes/No/All/Cancel question is asked.
.TP
.B gotoline .B gotoline
The 'goto line (and column)' menu. The 'goto line (and column)' menu.
.TP .TP

View File

@ -1713,6 +1713,8 @@ int strtomenu(const char *input)
return MREPLACE; return MREPLACE;
else if (!strcasecmp(input, "replacewith")) else if (!strcasecmp(input, "replacewith"))
return MREPLACEWITH; return MREPLACEWITH;
else if (!strcasecmp(input, "yesno"))
return MYESNO;
else if (!strcasecmp(input, "gotoline")) else if (!strcasecmp(input, "gotoline"))
return MGOTOLINE; return MGOTOLINE;
else if (!strcasecmp(input, "writeout")) else if (!strcasecmp(input, "writeout"))

View File

@ -678,6 +678,8 @@ int do_yesno_prompt(bool all, const char *msg)
if (!ISSET(NO_HELP)) { if (!ISSET(NO_HELP)) {
char shortstr[MAXCHARLEN + 2]; char shortstr[MAXCHARLEN + 2];
/* Temporary string for (translated) " Y", " N" and " A". */ /* Temporary string for (translated) " Y", " N" and " A". */
const sc *cancelshortcut = first_sc_for(MYESNO, do_cancel);
/* The keystroke that is bound to the Cancel function. */
if (COLS < 32) if (COLS < 32)
width = COLS / 2; width = COLS / 2;
@ -701,7 +703,7 @@ int do_yesno_prompt(bool all, const char *msg)
} }
wmove(bottomwin, 2, width); wmove(bottomwin, 2, width);
post_one_key("^C", _("Cancel"), width); post_one_key(cancelshortcut->keystr, _("Cancel"), width);
} }
/* Color the statusbar over its full width and display the question. */ /* Color the statusbar over its full width and display the question. */