From: Benno Schulenberg Date: Wed, 26 Feb 2014 11:38:30 +0000 (+0000) Subject: Scrolling an extra amount when softwrap is on and the current line runs off. X-Git-Tag: v2.3.3~319 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=df7bba340fbf251a1383cef43db53c1a5f8238f8;p=nano.git Scrolling an extra amount when softwrap is on and the current line runs off. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4611 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- diff --git a/ChangeLog b/ChangeLog index a346e625..8c321443 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2014-02-26 Benno Schulenberg + * src/move.c (do_down), src/winio.c (edit_scroll) - Scroll an + extra amount when softwrap is on and the current line would + otherwise run off the screen, and recalculate maxrows after + each scroll. Solves bug #27550 reported by Hannes Schueller. + 2014-02-25 Benno Schulenberg * NEWS - Fix some typos and wordings, and rewrap a few lines. * src/global.c - Correcting some translator comments, removal diff --git a/src/move.c b/src/move.c index 782613da..7bac46b5 100644 --- a/src/move.c +++ b/src/move.c @@ -564,6 +564,7 @@ void do_down( ) { bool onlastline = FALSE; + int extra = 0; /* If we're at the bottom of the file, get out. */ if (openfile->current == openfile->filebot) @@ -580,6 +581,8 @@ void do_down( if (ISSET(SOFTWRAP)) { if (openfile->current->lineno - openfile->edittop->lineno >= maxrows) onlastline = TRUE; + /* Compute the extra amount to scroll when the current line is overlong. */ + extra = (strlenpt(openfile->current->data) / COLS + openfile->current_y + 2 - editwinrows); } /* If scroll_only is FALSE and if we're on the first line of the @@ -599,6 +602,9 @@ void do_down( editwinrows / 2 + 1); edit_refresh_needed = TRUE; + } else if (extra > 0) { + edit_scroll(DOWN_DIR, extra); + edit_refresh_needed = TRUE; } /* If we're above the last line of the edit window, update the line * we were on before and the line we're on now. The former needs to diff --git a/src/winio.c b/src/winio.c index 928214e5..63ee6f3f 100644 --- a/src/winio.c +++ b/src/winio.c @@ -3115,6 +3115,7 @@ void edit_scroll(scroll_dir direction, ssize_t nlines) openfile->current_x : 0); foo = foo->next; } + compute_maxrows(); } /* Update any lines between old_current and current that need to be