Commit c24545fe authored by David Lawrence Ramsey's avatar David Lawrence Ramsey Committed by Benno Schulenberg
Browse files

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().
No related merge requests found
Showing with 9 additions and 15 deletions
+9 -15
......@@ -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();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment