Commit 06ffcfaf authored by Benno Schulenberg's avatar Benno Schulenberg
Browse files

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: default avatarDavid Lawrence Ramsey <pooka109@gmail.com>
parent f2317cc6
Showing with 1 addition and 6 deletions
+1 -6
......@@ -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
......
......@@ -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;
}
......
......@@ -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);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment