scrolling: keep centering after large paste, also when line numbers widen

If a paste (or insertion) is more than a screenful, it will not set
'focusing' to FALSE.  In that case, and when line numbers are already
active, then 'focusing' should be kept set to TRUE, despite it getting
set to FALSE by ensure_firstcolumn_is_aligned().  That latter action
is meant to cushion size changes of the edit window, but in this case
the large paste (or insertion) should trump the size change.

This fixes https://savannah.gnu.org/bugs/?59981.

Bug existed since version 2.8.3, commit 2b385478.
master
Benno Schulenberg 2021-02-01 12:29:45 +01:00
parent d3fbc4d498
commit e0a4ee0148
1 changed files with 3 additions and 0 deletions

View File

@ -1235,6 +1235,8 @@ void confirm_margin(void)
needed_margin = 0;
if (needed_margin != margin) {
bool keep_focus = (margin > 0) && focusing;
margin = needed_margin;
editwincols = COLS - margin - thebar;
@ -1243,6 +1245,7 @@ void confirm_margin(void)
* and ensure a proper starting column for the first screen row. */
compute_the_extra_rows_per_line_from(openfile->filetop);
ensure_firstcolumn_is_aligned();
focusing = keep_focus;
#endif
/* The margin has changed -- schedule a full refresh. */
refresh_needed = TRUE;