mirror of git://git.sv.gnu.org/nano.git
tweaks: rename a variable, to be a bit more indicative
This commit is contained in:
parent
64fb0be8b2
commit
a7635ceb5d
|
@ -132,8 +132,8 @@ int editwincols = -1;
|
|||
/* The number of usable columns in the edit window: COLS - margin. */
|
||||
int margin = 0;
|
||||
/* The amount of space reserved at the left for line numbers. */
|
||||
int thebar = 0;
|
||||
/* Becomes 1 when a scrollbar is shown. */
|
||||
int sidebar = 0;
|
||||
/* Becomes 1 when the indicator "scroll bar" must be shown. */
|
||||
#ifndef NANO_TINY
|
||||
int *bardata = NULL;
|
||||
/* An array of characters that together depict the scrollbar. */
|
||||
|
|
10
src/help.c
10
src/help.c
|
@ -325,7 +325,7 @@ void help_init(void)
|
|||
void wrap_help_text_into_buffer(void)
|
||||
{
|
||||
/* Avoid overtight and overwide paragraphs in the introductory text. */
|
||||
size_t wrapping_point = ((COLS < 40) ? 40 : (COLS > 74) ? 74 : COLS) - thebar;
|
||||
size_t wrapping_point = ((COLS < 40) ? 40 : (COLS > 74) ? 74 : COLS) - sidebar;
|
||||
const char *ptr = start_of_body;
|
||||
size_t sum = 0;
|
||||
|
||||
|
@ -344,7 +344,7 @@ void wrap_help_text_into_buffer(void)
|
|||
char *oneline;
|
||||
|
||||
if (ptr == end_of_intro)
|
||||
wrapping_point = ((COLS < 40) ? 40 : COLS) - thebar;
|
||||
wrapping_point = ((COLS < 40) ? 40 : COLS) - sidebar;
|
||||
|
||||
if (ptr < end_of_intro || *(ptr - 1) == '\n') {
|
||||
length = break_line(ptr, wrapping_point, TRUE);
|
||||
|
@ -352,7 +352,7 @@ void wrap_help_text_into_buffer(void)
|
|||
shim = (*(ptr + length - 1) == ' ') ? 0 : 1;
|
||||
snprintf(oneline, length + shim, "%s", ptr);
|
||||
} else {
|
||||
length = break_line(ptr, ((COLS < 40) ? 22 : COLS - 18) - thebar, TRUE);
|
||||
length = break_line(ptr, ((COLS < 40) ? 22 : COLS - 18) - sidebar, TRUE);
|
||||
oneline = nmalloc(length + 5);
|
||||
snprintf(oneline, length + 5, "\t\t %s", ptr);
|
||||
}
|
||||
|
@ -433,7 +433,7 @@ void show_help(void)
|
|||
UNSET(WHITESPACE_DISPLAY);
|
||||
|
||||
#ifdef ENABLE_LINENUMBERS
|
||||
editwincols = COLS - thebar;
|
||||
editwincols = COLS - sidebar;
|
||||
margin = 0;
|
||||
#endif
|
||||
tabsize = 8;
|
||||
|
@ -539,7 +539,7 @@ void show_help(void)
|
|||
|
||||
#ifdef ENABLE_LINENUMBERS
|
||||
margin = was_margin;
|
||||
editwincols = COLS - margin - thebar;
|
||||
editwincols = COLS - margin - sidebar;
|
||||
#endif
|
||||
tabsize = was_tabsize;
|
||||
#ifdef ENABLE_COLOR
|
||||
|
|
10
src/nano.c
10
src/nano.c
|
@ -1048,10 +1048,10 @@ void regenerate_screen(void)
|
|||
endwin();
|
||||
refresh();
|
||||
|
||||
thebar = (ISSET(INDICATOR) && LINES > 5 && COLS > 9) ? 1 : 0;
|
||||
sidebar = (ISSET(INDICATOR) && LINES > 5 && COLS > 9) ? 1 : 0;
|
||||
bardata = nrealloc(bardata, LINES * sizeof(int));
|
||||
|
||||
editwincols = COLS - margin - thebar;
|
||||
editwincols = COLS - margin - sidebar;
|
||||
|
||||
/* Put the terminal in the desired state again, and
|
||||
* recreate the subwindows with their (new) sizes. */
|
||||
|
@ -1264,7 +1264,7 @@ void confirm_margin(void)
|
|||
bool keep_focus = (margin > 0) && focusing;
|
||||
|
||||
margin = needed_margin;
|
||||
editwincols = COLS - margin - thebar;
|
||||
editwincols = COLS - margin - sidebar;
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Ensure a proper starting column for the first screen row. */
|
||||
|
@ -2388,10 +2388,10 @@ int main(int argc, char **argv)
|
|||
curs_set(0);
|
||||
|
||||
#ifndef NANO_TINY
|
||||
thebar = (ISSET(INDICATOR) && LINES > 5 && COLS > 9) ? 1 : 0;
|
||||
sidebar = (ISSET(INDICATOR) && LINES > 5 && COLS > 9) ? 1 : 0;
|
||||
bardata = nrealloc(bardata, LINES * sizeof(int));
|
||||
#endif
|
||||
editwincols = COLS - thebar;
|
||||
editwincols = COLS - sidebar;
|
||||
|
||||
/* Set up the signal handlers. */
|
||||
signal_init();
|
||||
|
|
|
@ -93,7 +93,7 @@ extern WINDOW *footwin;
|
|||
extern int editwinrows;
|
||||
extern int editwincols;
|
||||
extern int margin;
|
||||
extern int thebar;
|
||||
extern int sidebar;
|
||||
#ifndef NANO_TINY
|
||||
extern int *bardata;
|
||||
extern ssize_t stripe_column;
|
||||
|
|
14
src/winio.c
14
src/winio.c
|
@ -2581,7 +2581,7 @@ void draw_row(int row, const char *converted, linestruct *line, size_t from_col)
|
|||
wclrtoeol(midwin);
|
||||
|
||||
#ifndef NANO_TINY
|
||||
if (thebar)
|
||||
if (sidebar)
|
||||
mvwaddch(midwin, row, COLS - 1, bardata[row]);
|
||||
#endif
|
||||
|
||||
|
@ -2859,7 +2859,7 @@ int update_line(linestruct *line, size_t index)
|
|||
}
|
||||
if (has_more) {
|
||||
wattron(midwin, hilite_attribute);
|
||||
mvwaddch(midwin, row, COLS - 1 - thebar, '>');
|
||||
mvwaddch(midwin, row, COLS - 1 - sidebar, '>');
|
||||
wattroff(midwin, hilite_attribute);
|
||||
}
|
||||
|
||||
|
@ -3044,7 +3044,7 @@ bool less_than_a_screenful(size_t was_lineno, size_t was_leftedge)
|
|||
}
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Draw a scroll bar on the righthand side of the screen. */
|
||||
/* Draw a "scroll bar" on the righthand side of the edit window. */
|
||||
void draw_scrollbar(void)
|
||||
{
|
||||
int fromline = openfile->edittop->lineno - 1;
|
||||
|
@ -3110,7 +3110,7 @@ void edit_scroll(bool direction)
|
|||
go_forward_chunks(editwinrows - nrows, &line, &leftedge);
|
||||
|
||||
#ifndef NANO_TINY
|
||||
if (thebar)
|
||||
if (sidebar)
|
||||
draw_scrollbar();
|
||||
|
||||
if (ISSET(SOFTWRAP)) {
|
||||
|
@ -3407,7 +3407,7 @@ void edit_refresh(void)
|
|||
#endif
|
||||
|
||||
#ifndef NANO_TINY
|
||||
if (thebar)
|
||||
if (sidebar)
|
||||
draw_scrollbar();
|
||||
#endif
|
||||
|
||||
|
@ -3430,7 +3430,7 @@ void edit_refresh(void)
|
|||
while (row < editwinrows) {
|
||||
blank_row(midwin, row);
|
||||
#ifndef NANO_TINY
|
||||
if (thebar)
|
||||
if (sidebar)
|
||||
mvwaddch(midwin, row, COLS - 1, bardata[row]);
|
||||
#endif
|
||||
row++;
|
||||
|
@ -3549,7 +3549,7 @@ void spotlight(size_t from_col, size_t to_col)
|
|||
wattron(midwin, interface_color_pair[SPOTLIGHTED]);
|
||||
waddnstr(midwin, word, actual_x(word, to_col));
|
||||
if (overshoots)
|
||||
mvwaddch(midwin, openfile->current_y, COLS - 1 - thebar, '>');
|
||||
mvwaddch(midwin, openfile->current_y, COLS - 1 - sidebar, '>');
|
||||
wattroff(midwin, interface_color_pair[SPOTLIGHTED]);
|
||||
|
||||
free(word);
|
||||
|
|
Loading…
Reference in New Issue