Commit 0bffd99d authored by Benno Schulenberg's avatar Benno Schulenberg
Browse files

scrolling: elide a variable, to make clearer that edittop is being moved

parent 4c075f37
Showing with 9 additions and 10 deletions
+9 -10
......@@ -3032,8 +3032,7 @@ void edit_refresh(void)
* more than needed to bring current into view. */
void edit_update(update_type manner)
{
filestruct *foo = openfile->current;
int goal;
int goal = 0;
/* If manner is CENTERING, move edittop half the number of window
* lines back from current. If manner is STATIONARY, move edittop
......@@ -3047,9 +3046,7 @@ void edit_update(update_type manner)
if (manner == CENTERING)
goal = editwinrows / 2;
else if (manner == FLOWING) {
if (openfile->current->lineno < openfile->edittop->lineno)
goal = 0;
else
if (openfile->current->lineno >= openfile->edittop->lineno)
goal = editwinrows - 1;
} else {
goal = openfile->current_y;
......@@ -3059,14 +3056,16 @@ void edit_update(update_type manner)
goal = editwinrows - 1;
}
for (; goal > 0 && foo->prev != NULL; goal--) {
foo = foo->prev;
openfile->edittop = openfile->current;
while (goal > 0 && openfile->edittop->prev != NULL) {
openfile->edittop = openfile->edittop->prev;
goal --;
#ifndef NANO_TINY
if (ISSET(SOFTWRAP) && foo)
goal -= strlenpt(foo->data) / COLS;
if (ISSET(SOFTWRAP))
goal -= strlenpt(openfile->edittop->data) / COLS;
#endif
}
openfile->edittop = foo;
#ifdef DEBUG
fprintf(stderr, "edit_update(): setting edittop to lineno %ld\n", (long)openfile->edittop->lineno);
#endif
......
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