nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 93152d325842df61936d58dead79f4e8dd68e00f
parent 2f6c8987ea8870be6838d9ba1d6f459c602fd9d0
Author: David Lawrence Ramsey <pooka109@gmail.com>
Date:   Tue, 31 Jan 2017 19:23:21 -0600

softwrap: account for firstcolumn when scrolling up a line

In do_up() when scroll_only is TRUE, if we're at the top of the screen
in softwrap mode, it's not enough to check that edittop is on fileage.
We also need to check that firstcolumn is zero.

In do_up() when scroll_only is FALSE, if we're at the top of the screen
in softwrap mode, current_y should be zero.  This is equivalent to how,
in do_down() when scroll_only is FALSE, current_y is (editwinrows - 1)
at the bottom of the screen in softwrap mode.  Since edittop can now
be partially scrolled off the screen even when it takes up the entire
screen, checking for edittop's being equal to openfile->current->next
there no longer applies.

Diffstat:
Msrc/move.c | 5+++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/move.c b/src/move.c @@ -459,7 +459,8 @@ void do_up(bool scroll_only) size_t target_column = openfile->placewewant; /* When just scrolling and the top of the file is onscreen, get out. */ - if (scroll_only && openfile->edittop == openfile->fileage) + if (scroll_only && openfile->edittop == openfile->fileage && + openfile->firstcolumn == 0) return; #ifndef NANO_TINY @@ -480,7 +481,7 @@ void do_up(bool scroll_only) /* When the cursor was on the first line of the edit window (or when just * scrolling without moving the cursor), scroll the edit window up -- one * line if we're in smooth scrolling mode, and half a page otherwise. */ - if (openfile->current->next == openfile->edittop || scroll_only) + if (openfile->current_y == 0 || scroll_only) edit_scroll(UPWARD, (ISSET(SMOOTH_SCROLL) || scroll_only) ? 1 : editwinrows / 2 + 1);