commit 0208ae7149e8c4576ac81834a4653c54a6e8bdf5
parent 26fb907aa654b9709216c54193d9e7572e36472f
Author: Benno Schulenberg <bensberg@justemail.net>
Date: Thu, 12 Jan 2017 17:33:46 +0100
tweaks: rename a variable -- lines refers to buffer, rows to screen
Diffstat:
4 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/src/global.c b/src/global.c
@@ -94,8 +94,8 @@ WINDOW *bottomwin;
* messages, the statusbar prompt, and a list of shortcuts. */
int editwinrows = 0;
/* How many rows does the edit window take up? */
-int maxrows = 0;
- /* How many usable lines there are (due to soft wrapping). */
+int maxlines = 0;
+ /* How many file lines can be shown (due to soft wrapping). */
filestruct *cutbuffer = NULL;
/* The buffer where we store cut text. */
diff --git a/src/move.c b/src/move.c
@@ -100,7 +100,7 @@ void do_page_down(void)
/* If the cursor is less than a page away from the bottom of the file,
* put it at the end of the last line. */
- if (openfile->current->lineno + maxrows - 2 >= openfile->filebot->lineno) {
+ if (openfile->current->lineno + maxlines - 2 >= openfile->filebot->lineno) {
do_last_line();
return;
}
@@ -112,7 +112,7 @@ void do_page_down(void)
openfile->placewewant = openfile->current_y = 0;
}
- mustmove = (maxrows < 3) ? 1 : maxrows - 2;
+ mustmove = (maxlines < 3) ? 1 : maxlines - 2;
for (i = mustmove; i > 0 && openfile->current != openfile->filebot; i--) {
openfile->current = openfile->current->next;
diff --git a/src/proto.h b/src/proto.h
@@ -76,7 +76,7 @@ extern WINDOW *topwin;
extern WINDOW *edit;
extern WINDOW *bottomwin;
extern int editwinrows;
-extern int maxrows;
+extern int maxlines;
extern filestruct *cutbuffer;
extern filestruct *cutbottom;
diff --git a/src/winio.c b/src/winio.c
@@ -2755,30 +2755,30 @@ bool need_horizontal_scroll(const size_t old_column, const size_t new_column)
/* When edittop changes, try and figure out how many lines we really
* have to work with, accounting for softwrap mode. */
-void compute_maxrows(void)
+void compute_maxlines(void)
{
#ifndef NANO_TINY
if (ISSET(SOFTWRAP)) {
int screenrow;
filestruct *line = openfile->edittop;
- maxrows = 0;
+ maxlines = 0;
for (screenrow = 0; screenrow < editwinrows && line != NULL; screenrow++) {
screenrow += strlenpt(line->data) / editwincols;
line = line->next;
- maxrows++;
+ maxlines++;
}
if (screenrow < editwinrows)
- maxrows += editwinrows - screenrow;
+ maxlines += editwinrows - screenrow;
#ifdef DEBUG
- fprintf(stderr, "recomputed: maxrows = %d\n", maxrows);
+ fprintf(stderr, "recomputed: maxlines = %d\n", maxlines);
#endif
} else
#endif /* !NANO_TINY */
- maxrows = editwinrows;
+ maxlines = editwinrows;
}
/* Scroll the edit window in the given direction and the given number
@@ -2877,7 +2877,7 @@ void edit_scroll(scroll_dir direction, ssize_t nlines)
foo = foo->next;
}
- compute_maxrows();
+ compute_maxlines();
}
/* Update any lines between old_current and current that need to be
@@ -2889,9 +2889,9 @@ void edit_redraw(filestruct *old_current)
openfile->placewewant = xplustabs();
/* If the current line is offscreen, scroll until it's onscreen. */
- if (openfile->current->lineno >= openfile->edittop->lineno + maxrows ||
+ if (openfile->current->lineno >= openfile->edittop->lineno + maxlines ||
#ifndef NANO_TINY
- (openfile->current->lineno == openfile->edittop->lineno + maxrows - 1 &&
+ (openfile->current->lineno == openfile->edittop->lineno + maxlines - 1 &&
ISSET(SOFTWRAP) && strlenpt(openfile->current->data) >= editwincols) ||
#endif
openfile->current->lineno < openfile->edittop->lineno) {
@@ -2933,15 +2933,15 @@ void edit_refresh(void)
filestruct *line;
int row = 0;
- /* Figure out what maxrows should really be. */
- compute_maxrows();
+ /* Figure out what maxlines should really be. */
+ compute_maxlines();
/* If the current line is out of view, get it back on screen. */
if (openfile->current->lineno < openfile->edittop->lineno ||
- openfile->current->lineno >= openfile->edittop->lineno + maxrows) {
+ openfile->current->lineno >= openfile->edittop->lineno + maxlines) {
#ifdef DEBUG
- fprintf(stderr, "edit-refresh: line = %ld, edittop = %ld and maxrows = %d\n",
- (long)openfile->current->lineno, (long)openfile->edittop->lineno, maxrows);
+ fprintf(stderr, "edit-refresh: line = %ld, edittop = %ld and maxlines = %d\n",
+ (long)openfile->current->lineno, (long)openfile->edittop->lineno, maxlines);
#endif
adjust_viewport((focusing || !ISSET(SMOOTH_SCROLL)) ? CENTERING : STATIONARY);
}
@@ -3021,7 +3021,7 @@ void adjust_viewport(update_type manner)
#ifdef DEBUG
fprintf(stderr, "adjust_viewport(): setting edittop to lineno %ld\n", (long)openfile->edittop->lineno);
#endif
- compute_maxrows();
+ compute_maxlines();
}
/* Unconditionally redraw the entire screen. */