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.master
parent
2f6c8987ea
commit
93152d3258
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue