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-d3aeb78583b8
Этот коммит содержится в:
родитель
b1a7fddc33
Коммит
54a11058ee
@ -4,6 +4,9 @@
|
||||
* src/move.c (do_down) - Correctly compute the minimum amount
|
||||
to scroll when softwrap is on and there are overlong lines.
|
||||
* 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>
|
||||
* 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
|
||||
)
|
||||
{
|
||||
bool onlastline = FALSE;
|
||||
#ifndef NANO_TINY
|
||||
int amount, enough = 0;
|
||||
filestruct *topline;
|
||||
#endif
|
||||
|
||||
/* If we're at the bottom of the file, get out. */
|
||||
if (openfile->current == openfile->filebot)
|
||||
return;
|
||||
|
||||
|
||||
assert(ISSET(SOFTWRAP) || openfile->current_y == openfile->current->lineno - openfile->edittop->lineno);
|
||||
|
||||
/* 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->placewewant);
|
||||
|
||||
#ifndef NANO_TINY
|
||||
if (ISSET(SOFTWRAP)) {
|
||||
if (openfile->current->lineno - openfile->edittop->lineno >= maxrows)
|
||||
onlastline = TRUE;
|
||||
/* Compute the amount to scroll. */
|
||||
amount = (strlenpt(openfile->current->data) / COLS + openfile->current_y + 2
|
||||
+ strlenpt(openfile->current->prev->data) / COLS - editwinrows);
|
||||
@ -596,26 +595,27 @@ void do_down(
|
||||
topline = topline->next;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* 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
|
||||
* smooth scrolling mode, or down half a page if we're not. If
|
||||
* scroll_only is TRUE, scroll the edit window down one line
|
||||
* unconditionally. */
|
||||
if (onlastline || openfile->current_y == editwinrows - 1
|
||||
if (openfile->current_y == editwinrows - 1
|
||||
#ifndef NANO_TINY
|
||||
|| scroll_only
|
||||
|| amount > 0 || scroll_only
|
||||
#endif
|
||||
) {
|
||||
#ifndef NANO_TINY
|
||||
if (amount < 1 || scroll_only)
|
||||
amount = 1;
|
||||
#endif
|
||||
edit_scroll(DOWN_DIR,
|
||||
#ifndef NANO_TINY
|
||||
(ISSET(SMOOTH_SCROLL) || scroll_only) ? (amount ? amount : 1) :
|
||||
(ISSET(SMOOTH_SCROLL) || scroll_only) ? amount :
|
||||
#endif
|
||||
editwinrows / 2 + 1);
|
||||
|
||||
edit_refresh_needed = TRUE;
|
||||
} else if (amount > 0) {
|
||||
edit_scroll(DOWN_DIR, amount);
|
||||
edit_refresh_needed = TRUE;
|
||||
}
|
||||
/* If we're above the last line of the edit window, update the line
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user