nano

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

commit 06ffcfaf403be022c92649611f633e7feba7f52c
parent f2317cc64edd2e3a43becd12af6cf95db9222c0b
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Tue,  8 Aug 2017 21:52:54 +0200

display: catch all cases where the cursor can be pushed offscreen

Discarding (in commit 6f9bb53b) the cap on the number of chunks to
move backwards had as an unforeseen side effect that the screen can
fail to scroll when the cursor is somehow pushed offscreen.

Fix this by setting the target row (for smooth scrolling) always to
the bottom row of the edit window when nano notices that the cursor
has gone offscreen.

This fixes https://savannah.gnu.org/bugs/?51676.
Reported-by: David Lawrence Ramsey <pooka109@gmail.com>

Diffstat:
Msrc/cut.c | 3---
Msrc/files.c | 3---
Msrc/winio.c | 1+
3 files changed, 1 insertion(+), 6 deletions(-)

diff --git a/src/cut.c b/src/cut.c @@ -290,9 +290,6 @@ void do_uncut_text(void) /* Mark the file as modified. */ set_modified(); - /* Set the target row for the cursor in case it got pushed offscreen. */ - openfile->current_y = editwinrows - 1; - refresh_needed = TRUE; #ifndef DISABLE_COLOR diff --git a/src/files.c b/src/files.c @@ -1185,9 +1185,6 @@ void do_insertfile(void) openfile->current_x != was_current_x) set_modified(); - /* Set the target row for the cursor when pushed offscreen. */ - openfile->current_y = editwinrows - 1; - refresh_needed = TRUE; } diff --git a/src/winio.c b/src/winio.c @@ -3216,6 +3216,7 @@ void edit_refresh(void) fprintf(stderr, "edit-refresh: line = %ld, edittop = %ld and editwinrows = %d\n", (long)openfile->current->lineno, (long)openfile->edittop->lineno, editwinrows); #endif + openfile->current_y = editwinrows - 1; adjust_viewport((focusing || !ISSET(SMOOTH_SCROLL)) ? CENTERING : STATIONARY); }