tweaks: elide two unneeded variables from line numbering mode
Instead compute directly whether we're at a softwrapped part or not.master
parent
bd920b1f49
commit
c9f743f676
|
@ -49,12 +49,6 @@ int margin = 0;
|
||||||
/* The amount of space reserved at the left for line numbers. */
|
/* The amount of space reserved at the left for line numbers. */
|
||||||
int editwincols = -1;
|
int editwincols = -1;
|
||||||
/* The number of usable columns in the edit window: COLS - margin. */
|
/* The number of usable columns in the edit window: COLS - margin. */
|
||||||
#ifdef ENABLE_LINENUMBERS
|
|
||||||
int last_drawn_line = 0;
|
|
||||||
/* The line number of the last drawn line. */
|
|
||||||
int last_line_y;
|
|
||||||
/* The y coordinate of the last drawn line. */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
message_type lastmessage = HUSH;
|
message_type lastmessage = HUSH;
|
||||||
/* Messages of type HUSH should not overwrite type MILD nor ALERT. */
|
/* Messages of type HUSH should not overwrite type MILD nor ALERT. */
|
||||||
|
|
|
@ -40,10 +40,6 @@ extern bool focusing;
|
||||||
|
|
||||||
extern int margin;
|
extern int margin;
|
||||||
extern int editwincols;
|
extern int editwincols;
|
||||||
#ifdef ENABLE_LINENUMBERS
|
|
||||||
extern int last_drawn_line;
|
|
||||||
extern int last_line_y;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern message_type lastmessage;
|
extern message_type lastmessage;
|
||||||
|
|
||||||
|
|
12
src/winio.c
12
src/winio.c
|
@ -2322,10 +2322,12 @@ void edit_draw(filestruct *fileptr, const char *converted, int
|
||||||
* the text -- but only for the parts that are not softwrapped. */
|
* the text -- but only for the parts that are not softwrapped. */
|
||||||
if (margin > 0) {
|
if (margin > 0) {
|
||||||
wattron(edit, interface_color_pair[LINE_NUMBER]);
|
wattron(edit, interface_color_pair[LINE_NUMBER]);
|
||||||
if (last_drawn_line != fileptr->lineno || last_line_y >= line)
|
#ifndef NANO_TINY
|
||||||
mvwprintw(edit, line, 0, "%*ld", margin - 1, (long)fileptr->lineno);
|
if (ISSET(SOFTWRAP) && (startpos / editwincols > 0))
|
||||||
else
|
|
||||||
mvwprintw(edit, line, 0, "%*s", margin - 1, " ");
|
mvwprintw(edit, line, 0, "%*s", margin - 1, " ");
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
mvwprintw(edit, line, 0, "%*ld", margin - 1, (long)fileptr->lineno);
|
||||||
wattroff(edit, interface_color_pair[LINE_NUMBER]);
|
wattroff(edit, interface_color_pair[LINE_NUMBER]);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -2693,10 +2695,6 @@ void edit_draw(filestruct *fileptr, const char *converted, int
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* !NANO_TINY */
|
#endif /* !NANO_TINY */
|
||||||
#ifdef ENABLE_LINENUMBERS
|
|
||||||
last_drawn_line = fileptr->lineno;
|
|
||||||
last_line_y = line;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Just update one line in the edit buffer. This is basically a wrapper
|
/* Just update one line in the edit buffer. This is basically a wrapper
|
||||||
|
|
Loading…
Reference in New Issue