Commit c9199e9e authored by Chris Allegretta's avatar Chris Allegretta
Browse files

Simplify logic in do_down() since we now have maxrows to rely on.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4442 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
No related merge requests found
Showing with 7 additions and 13 deletions
+7 -13
...@@ -75,9 +75,13 @@ void do_page_up(void) ...@@ -75,9 +75,13 @@ void do_page_up(void)
for (i = editwinrows - 2; i - skipped > 0 && openfile->current != for (i = editwinrows - 2; i - skipped > 0 && openfile->current !=
openfile->fileage; i--) { openfile->fileage; i--) {
openfile->current = openfile->current->prev; openfile->current = openfile->current->prev;
if (ISSET(SOFTWRAP) && openfile->current) if (ISSET(SOFTWRAP) && openfile->current) {
skipped += strlenpt(openfile->current->data) / COLS; skipped += strlenpt(openfile->current->data) / COLS;
#ifdef DEBUG
fprintf(stderr, "do_page_up: i = %d, skipped = %d based on line %ld len %d\n", i, (unsigned long) skipped,
openfile->current->lineno, strlenpt(openfile->current->data));
#endif
}
} }
openfile->current_x = actual_x(openfile->current->data, openfile->current_x = actual_x(openfile->current->data,
...@@ -573,17 +577,7 @@ void do_down( ...@@ -573,17 +577,7 @@ void do_down(
openfile->placewewant); openfile->placewewant);
if (ISSET(SOFTWRAP)) { if (ISSET(SOFTWRAP)) {
filestruct *foo; if (openfile->current->lineno - openfile->edittop->lineno >= maxrows)
ssize_t extracuzsoft = 0;
for (foo = openfile->edittop; foo
&& foo->lineno - openfile->edittop->lineno + extracuzsoft < editwinrows;
foo = foo->next) {
extracuzsoft += strlenpt(foo->data) / (COLS - 1);
if (foo == openfile->current)
break;
}
if (foo && foo->lineno - openfile->edittop->lineno + extracuzsoft >= editwinrows)
onlastline = TRUE; onlastline = TRUE;
} }
......
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