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.
No related merge requests found
Showing with 10 additions and 2 deletions
+10 -2
...@@ -2970,8 +2970,13 @@ void edit_update(update_type manner) ...@@ -2970,8 +2970,13 @@ void edit_update(update_type manner)
if (manner == CENTERING) if (manner == CENTERING)
goal = editwinrows / 2; goal = editwinrows / 2;
else if (manner == FLOWING) { else if (manner == FLOWING) {
if (openfile->current->lineno >= openfile->edittop->lineno) if (openfile->current->lineno >= openfile->edittop->lineno) {
goal = editwinrows - 1; goal = editwinrows - 1;
#ifndef NANO_TINY
if (ISSET(SOFTWRAP))
goal -= strlenpt(openfile->current->data) / COLS ;
#endif
}
} else { } else {
goal = openfile->current_y; goal = openfile->current_y;
...@@ -2986,8 +2991,11 @@ void edit_update(update_type manner) ...@@ -2986,8 +2991,11 @@ void edit_update(update_type manner)
openfile->edittop = openfile->edittop->prev; openfile->edittop = openfile->edittop->prev;
goal --; goal --;
#ifndef NANO_TINY #ifndef NANO_TINY
if (ISSET(SOFTWRAP)) if (ISSET(SOFTWRAP)) {
goal -= strlenpt(openfile->edittop->data) / COLS; goal -= strlenpt(openfile->edittop->data) / COLS;
if (goal < 0)
openfile->edittop = openfile->edittop->next;
}
#endif #endif
} }
#ifdef DEBUG #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