diff --git a/ChangeLog b/ChangeLog index a346e625356de1473dbabb8d9502187dd0c84315..8c32144370ab031a9d90b0d1988e951328e99016 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2014-02-26 Benno Schulenberg <bensberg@justemail.net> + * 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 <bensberg@justemail.net> * 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 782613dad5903e7788fb306edeedf9378e325838..7bac46b55c92cffb6b79a043cf6ee07a9e7c7c1b 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 928214e50c80d5a3b69dad92e0dc3d1dd74f01f4..63ee6f3fc58c80aa39625e71f8bbf0b334fd1f33 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