prompt: toggle the help lines only for the 'nohelp' toggle

This fixes https://savannah.gnu.org/bugs/?62914.

Problem existed since commit 958ec294 from three days ago.
This commit is contained in:
Benno Schulenberg 2022-08-21 10:17:54 +02:00
parent aba4f4e0e2
commit a374dd0359
2 changed files with 6 additions and 4 deletions

View File

@ -523,7 +523,7 @@ char *browse(char *path)
#ifndef NANO_TINY
/* The terminal dimensions might have changed, so act as if. */
kbinput = KEY_WINCH;
} else if (function == do_toggle) {
} else if (function == do_toggle && get_shortcut(kbinput)->toggle == NO_HELP) {
TOGGLE(NO_HELP);
window_init();
kbinput = KEY_WINCH;

View File

@ -520,7 +520,7 @@ functionptrtype acquire_an_answer(int *actual, bool *listed,
if (function == do_help || function == full_refresh)
function();
#ifndef NANO_TINY
else if (function == do_toggle) {
else if (function == do_toggle && shortcut->toggle == NO_HELP) {
TOGGLE(NO_HELP);
window_init();
focusing = FALSE;
@ -639,6 +639,7 @@ int ask_user(bool withall, const char *question)
const char *yesstr = _("Yy");
const char *nostr = _("Nn");
const char *allstr = _("Aa");
const keystruct *shortcut;
functionptrtype function;
while (choice == UNDECIDED) {
@ -735,14 +736,15 @@ int ask_user(bool withall, const char *question)
if (choice != UNDECIDED)
break;
function = func_from_key(kbinput);
shortcut = get_shortcut(kbinput);
function = (shortcut ? shortcut->func : NULL);
if (function == do_cancel)
choice = CANCEL;
else if (function == full_refresh)
full_refresh();
#ifndef NANO_TINY
else if (function == do_toggle) {
else if (function == do_toggle && shortcut->toggle == NO_HELP) {
TOGGLE(NO_HELP);
window_init();
titlebar(NULL);