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.
master
Benno Schulenberg 2016-09-15 10:43:49 +02:00
parent 8ba57cf87b
commit 598e0af7af
1 changed files with 10 additions and 2 deletions

View File

@ -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