commit 418bd3be34727f1317b29b2da23b20d23f775d68
parent 41704548377f1487ee1ae33877c1c176669c9e82
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Sun, 5 Aug 2018 20:01:47 +0200
rcfile: allow to rebind the Cancel function in the yesno menu
This fixes the first part of https://savannah.gnu.org/bugs/?54447.
Diffstat:
4 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/doc/nano.texi b/doc/nano.texi
@@ -1441,6 +1441,9 @@ The 'search to replace' menu.
@item replacewith
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
The 'goto line (and column)' menu.
diff --git a/doc/nanorc.5 b/doc/nanorc.5
@@ -792,6 +792,9 @@ The 'search to replace' menu.
.B replacewith
The 'replace with' menu, which comes up after 'search to replace'.
.TP
+.B yesno
+The 'yesno' menu, where the Yes/No/All/Cancel question is asked.
+.TP
.B gotoline
The 'goto line (and column)' menu.
.TP
diff --git a/src/global.c b/src/global.c
@@ -1713,6 +1713,8 @@ int strtomenu(const char *input)
return MREPLACE;
else if (!strcasecmp(input, "replacewith"))
return MREPLACEWITH;
+ else if (!strcasecmp(input, "yesno"))
+ return MYESNO;
else if (!strcasecmp(input, "gotoline"))
return MGOTOLINE;
else if (!strcasecmp(input, "writeout"))
diff --git a/src/prompt.c b/src/prompt.c
@@ -678,6 +678,8 @@ int do_yesno_prompt(bool all, const char *msg)
if (!ISSET(NO_HELP)) {
char shortstr[MAXCHARLEN + 2];
/* 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)
width = COLS / 2;
@@ -701,7 +703,7 @@ int do_yesno_prompt(bool all, const char *msg)
}
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. */