moving: use edit_scroll() only when scrolling one row is enough

When softwrapping with a tabsize larger than the width of the viewport,
scrolling one row when the cursor goes offscreen might not be enough,
so in that case use edit_redraw() instead.

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

Bug existed since version 2.9.6, commit 0d9080a2.
This commit is contained in:
Benno Schulenberg 2024-06-10 07:51:44 +02:00
parent aa844ada4e
commit 6c81f60914
1 changed files with 4 additions and 2 deletions

View File

@ -567,7 +567,8 @@ void do_up(void)
set_proper_index_and_pww(&leftedge, target_column, FALSE);
if (openfile->cursor_row == 0 && !ISSET(JUMPY_SCROLLING))
if (openfile->cursor_row == 0 && !ISSET(JUMPY_SCROLLING) &&
(tabsize < editwincols || !ISSET(SOFTWRAP)))
edit_scroll(BACKWARD);
else
edit_redraw(was_current, FLOWING);
@ -590,7 +591,8 @@ void do_down(void)
set_proper_index_and_pww(&leftedge, target_column, TRUE);
if (openfile->cursor_row == editwinrows - 1 && !ISSET(JUMPY_SCROLLING))
if (openfile->cursor_row == editwinrows - 1 && !ISSET(JUMPY_SCROLLING) &&
(tabsize < editwincols || !ISSET(SOFTWRAP)))
edit_scroll(FORWARD);
else
edit_redraw(was_current, FLOWING);