tweaks: reshuffle some code, and reduce the scope of a variable
parent
399a024857
commit
c2746c0bb2
26
src/nano.c
26
src/nano.c
|
@ -1065,8 +1065,6 @@ void regenerate_screen(void)
|
||||||
/* Handle the global toggle specified in flag. */
|
/* Handle the global toggle specified in flag. */
|
||||||
void do_toggle(int flag)
|
void do_toggle(int flag)
|
||||||
{
|
{
|
||||||
bool enabled;
|
|
||||||
|
|
||||||
if (flag == SUSPENDABLE && in_restricted_mode())
|
if (flag == SUSPENDABLE && in_restricted_mode())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -1102,25 +1100,27 @@ void do_toggle(int flag)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ISSET(STATEFLAGS) && (flag == AUTOINDENT ||
|
if (!ISSET(MINIBAR) && ISSET(STATEFLAGS))
|
||||||
flag == BREAK_LONG_LINES || flag == SOFTWRAP))
|
if (flag == AUTOINDENT || flag == BREAK_LONG_LINES || flag == SOFTWRAP)
|
||||||
titlebar(NULL);
|
titlebar(NULL);
|
||||||
|
|
||||||
enabled = ISSET(flag);
|
if (ISSET(MINIBAR) && (flag == NO_HELP || flag == LINE_NUMBERS ))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (flag == CONSTANT_SHOW)
|
||||||
|
wipe_statusbar();
|
||||||
|
else if (!ISSET(MINIBAR) || !ISSET(STATEFLAGS) || flag == SMART_HOME ||
|
||||||
|
flag == NO_SYNTAX || flag == WHITESPACE_DISPLAY ||
|
||||||
|
flag == CUT_FROM_CURSOR || flag == TABS_TO_SPACES ||
|
||||||
|
flag == USE_MOUSE || flag == SUSPENDABLE) {
|
||||||
|
bool enabled = ISSET(flag);
|
||||||
|
|
||||||
if (flag == NO_HELP || flag == NO_SYNTAX)
|
if (flag == NO_HELP || flag == NO_SYNTAX)
|
||||||
enabled = !enabled;
|
enabled = !enabled;
|
||||||
|
|
||||||
if (flag == CONSTANT_SHOW)
|
|
||||||
wipe_statusbar();
|
|
||||||
else if (ISSET(MINIBAR) && (flag == NO_HELP || flag == LINE_NUMBERS ))
|
|
||||||
;
|
|
||||||
else
|
|
||||||
if (!ISSET(MINIBAR) || !ISSET(STATEFLAGS) || flag == SMART_HOME || flag == CUT_FROM_CURSOR ||
|
|
||||||
flag == NO_SYNTAX || flag == WHITESPACE_DISPLAY ||
|
|
||||||
flag == TABS_TO_SPACES || flag == USE_MOUSE || flag == SUSPENDABLE)
|
|
||||||
statusline(REMARK, "%s %s", _(flagtostr(flag)),
|
statusline(REMARK, "%s %s", _(flagtostr(flag)),
|
||||||
enabled ? _("enabled") : _("disabled"));
|
enabled ? _("enabled") : _("disabled"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif /* !NANO_TINY */
|
#endif /* !NANO_TINY */
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue