Commit 598e0af7 authored by Benno Schulenberg's avatar Benno Schulenberg
Browse files

softwrap: scroll the current line fully into view when jumping words

This fixes https://savannah.gnu.org/bugs/?47710
and fixes https://savannah.gnu.org/bugs/?49088.
parent 8ba57cf8
Showing with 10 additions and 2 deletions
+10 -2
......@@ -2970,8 +2970,13 @@ void edit_update(update_type manner)
if (manner == CENTERING)
goal = editwinrows / 2;
else if (manner == FLOWING) {
if (openfile->current->lineno >= openfile->edittop->lineno)
if (openfile->current->lineno >= openfile->edittop->lineno) {
goal = editwinrows - 1;
#ifndef NANO_TINY
if (ISSET(SOFTWRAP))
goal -= strlenpt(openfile->current->data) / COLS ;
#endif
}
} else {
goal = openfile->current_y;
......@@ -2986,8 +2991,11 @@ void edit_update(update_type manner)
openfile->edittop = openfile->edittop->prev;
goal --;
#ifndef NANO_TINY
if (ISSET(SOFTWRAP))
if (ISSET(SOFTWRAP)) {
goal -= strlenpt(openfile->edittop->data) / COLS;
if (goal < 0)
openfile->edittop = openfile->edittop->next;
}
#endif
}
#ifdef DEBUG
......
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