tweaks: always directly do a refresh when the margin changes

The previous code only directly refreshed the screen when the margin
changed due to toggling line numbering on.  When the margin changed
due to toggling it off, it would indirectly refresh via do_toggle().
master
David Lawrence Ramsey 2017-02-09 10:20:04 -06:00 committed by Benno Schulenberg
parent 8fbadecf0a
commit c24545fe9a
1 changed files with 9 additions and 15 deletions

View File

@ -1383,9 +1383,6 @@ void do_toggle(int flag)
titlebar(NULL); /* Fall through. */
#ifndef DISABLE_COLOR
case NO_COLOR_SYNTAX:
#endif
#ifdef ENABLE_LINENUMBERS
case LINE_NUMBERS:
#endif
case SOFTWRAP:
refresh_needed = TRUE;
@ -2646,19 +2643,16 @@ int main(int argc, char **argv)
int needed_margin = digits(openfile->filebot->lineno) + 1;
/* Only enable line numbers when there is enough room for them. */
if (ISSET(LINE_NUMBERS) && needed_margin < COLS - 3) {
if (!ISSET(LINE_NUMBERS) || needed_margin > COLS - 4)
needed_margin = 0;
if (needed_margin != margin) {
margin = needed_margin;
editwincols = COLS - margin;
/* The margin has changed -- schedule a full refresh. */
refresh_needed = TRUE;
}
} else
#endif
{
margin = 0;
editwincols = COLS;
}
if (currmenu != MMAIN)
display_main_list();