Trimming some redundant code, and correcting scrolling behaviour
without softwrap. And adding a few more NANO_TINY wrappings. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4633 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
b1a7fddc33
commit
54a11058ee
|
@ -4,6 +4,9 @@
|
||||||
* src/move.c (do_down) - Correctly compute the minimum amount
|
* src/move.c (do_down) - Correctly compute the minimum amount
|
||||||
to scroll when softwrap is on and there are overlong lines.
|
to scroll when softwrap is on and there are overlong lines.
|
||||||
* src/winio.c (edit_scroll) - Disable amount computation here.
|
* src/winio.c (edit_scroll) - Disable amount computation here.
|
||||||
|
* src/move.c (do_down) - Trim some redundant code, and correct
|
||||||
|
the scrolling behaviour when softwrap is off -- the construct
|
||||||
|
(amount ? amount : 1) wasn't doing what I intended.
|
||||||
|
|
||||||
2014-03-01 Chris Allegretta <chrisa@asty.org>
|
2014-03-01 Chris Allegretta <chrisa@asty.org>
|
||||||
* global.c (shortcut_init) - fix an issue with the split
|
* global.c (shortcut_init) - fix an issue with the split
|
||||||
|
|
22
src/move.c
22
src/move.c
|
@ -563,15 +563,15 @@ void do_down(
|
||||||
#endif
|
#endif
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
bool onlastline = FALSE;
|
#ifndef NANO_TINY
|
||||||
int amount, enough = 0;
|
int amount, enough = 0;
|
||||||
filestruct *topline;
|
filestruct *topline;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* 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)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
assert(ISSET(SOFTWRAP) || openfile->current_y == openfile->current->lineno - openfile->edittop->lineno);
|
assert(ISSET(SOFTWRAP) || openfile->current_y == openfile->current->lineno - openfile->edittop->lineno);
|
||||||
|
|
||||||
/* Move the current line of the edit window down. */
|
/* Move the current line of the edit window down. */
|
||||||
|
@ -579,9 +579,8 @@ void do_down(
|
||||||
openfile->current_x = actual_x(openfile->current->data,
|
openfile->current_x = actual_x(openfile->current->data,
|
||||||
openfile->placewewant);
|
openfile->placewewant);
|
||||||
|
|
||||||
|
#ifndef NANO_TINY
|
||||||
if (ISSET(SOFTWRAP)) {
|
if (ISSET(SOFTWRAP)) {
|
||||||
if (openfile->current->lineno - openfile->edittop->lineno >= maxrows)
|
|
||||||
onlastline = TRUE;
|
|
||||||
/* Compute the amount to scroll. */
|
/* Compute the amount to scroll. */
|
||||||
amount = (strlenpt(openfile->current->data) / COLS + openfile->current_y + 2
|
amount = (strlenpt(openfile->current->data) / COLS + openfile->current_y + 2
|
||||||
+ strlenpt(openfile->current->prev->data) / COLS - editwinrows);
|
+ strlenpt(openfile->current->prev->data) / COLS - editwinrows);
|
||||||
|
@ -596,26 +595,27 @@ void do_down(
|
||||||
topline = topline->next;
|
topline = topline->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* If scroll_only is FALSE and if we're on the last line of the
|
/* If scroll_only is FALSE and if we're on the last line of the
|
||||||
* edit window, scroll the edit window down one line if we're in
|
* edit window, scroll the edit window down one line if we're in
|
||||||
* smooth scrolling mode, or down half a page if we're not. If
|
* smooth scrolling mode, or down half a page if we're not. If
|
||||||
* scroll_only is TRUE, scroll the edit window down one line
|
* scroll_only is TRUE, scroll the edit window down one line
|
||||||
* unconditionally. */
|
* unconditionally. */
|
||||||
if (onlastline || openfile->current_y == editwinrows - 1
|
if (openfile->current_y == editwinrows - 1
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
|| scroll_only
|
|| amount > 0 || scroll_only
|
||||||
#endif
|
#endif
|
||||||
) {
|
) {
|
||||||
|
#ifndef NANO_TINY
|
||||||
|
if (amount < 1 || scroll_only)
|
||||||
|
amount = 1;
|
||||||
|
#endif
|
||||||
edit_scroll(DOWN_DIR,
|
edit_scroll(DOWN_DIR,
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
(ISSET(SMOOTH_SCROLL) || scroll_only) ? (amount ? amount : 1) :
|
(ISSET(SMOOTH_SCROLL) || scroll_only) ? amount :
|
||||||
#endif
|
#endif
|
||||||
editwinrows / 2 + 1);
|
editwinrows / 2 + 1);
|
||||||
|
|
||||||
edit_refresh_needed = TRUE;
|
|
||||||
} else if (amount > 0) {
|
|
||||||
edit_scroll(DOWN_DIR, amount);
|
|
||||||
edit_refresh_needed = TRUE;
|
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
|
||||||
|
|
Loading…
Reference in New Issue