1
1

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().
Этот коммит содержится в:
David Lawrence Ramsey 2017-02-09 10:20:04 -06:00 коммит произвёл Benno Schulenberg
родитель 8fbadecf0a
Коммит c24545fe9a

Просмотреть файл

@ -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 (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 (!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;
}
#endif
if (currmenu != MMAIN)
display_main_list();