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-d3aeb78583b8master
parent
db906ea121
commit
df7bba340f
|
@ -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>
|
2014-02-25 Benno Schulenberg <bensberg@justemail.net>
|
||||||
* NEWS - Fix some typos and wordings, and rewrap a few lines.
|
* NEWS - Fix some typos and wordings, and rewrap a few lines.
|
||||||
* src/global.c - Correcting some translator comments, removal
|
* src/global.c - Correcting some translator comments, removal
|
||||||
|
|
|
@ -564,6 +564,7 @@ void do_down(
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
bool onlastline = FALSE;
|
bool onlastline = FALSE;
|
||||||
|
int extra = 0;
|
||||||
|
|
||||||
/* If we're at the bottom of the file, get out. */
|
/* If we're at the bottom of the file, get out. */
|
||||||
if (openfile->current == openfile->filebot)
|
if (openfile->current == openfile->filebot)
|
||||||
|
@ -580,6 +581,8 @@ void do_down(
|
||||||
if (ISSET(SOFTWRAP)) {
|
if (ISSET(SOFTWRAP)) {
|
||||||
if (openfile->current->lineno - openfile->edittop->lineno >= maxrows)
|
if (openfile->current->lineno - openfile->edittop->lineno >= maxrows)
|
||||||
onlastline = TRUE;
|
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
|
/* 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);
|
editwinrows / 2 + 1);
|
||||||
|
|
||||||
edit_refresh_needed = TRUE;
|
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
|
/* 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
|
* we were on before and the line we're on now. The former needs to
|
||||||
|
|
|
@ -3115,6 +3115,7 @@ void edit_scroll(scroll_dir direction, ssize_t nlines)
|
||||||
openfile->current_x : 0);
|
openfile->current_x : 0);
|
||||||
foo = foo->next;
|
foo = foo->next;
|
||||||
}
|
}
|
||||||
|
compute_maxrows();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update any lines between old_current and current that need to be
|
/* Update any lines between old_current and current that need to be
|
||||||
|
|
Loading…
Reference in New Issue