nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 598e0af7aff754fc21d318dc7ea7cf276c20681a
parent 8ba57cf87bc636d9dc5d793ea9e6cfaa9d13b2af
Author: Benno Schulenberg <bensberg@justemail.net>
Date:   Thu, 15 Sep 2016 10:43:49 +0200

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.

Diffstat:
Msrc/winio.c | 12++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/winio.c b/src/winio.c @@ -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