scrolling: don't redraw entire edit window when cursor goes offscreen

When the cursor is on the top or bottom line of the edit window, and
an <Up> or <Down> pushes the cursor offscreen, then use edit_scroll()
to bring it back into view, instead of using edit_redraw(), because
the latter would redraw *every row* on the screen, which is a waste
of time.

This addresses https://savannah.gnu.org/bugs/?53562.
Reported-by: Devin Hussey <husseydevin@gmail.com>
master
Benno Schulenberg 2018-04-14 12:22:48 +02:00
parent 1ae90e205a
commit 0d9080a22c
1 changed files with 8 additions and 2 deletions

View File

@ -495,7 +495,10 @@ void do_up(void)
set_proper_index_and_pww(&leftedge, target_column, FALSE); set_proper_index_and_pww(&leftedge, target_column, FALSE);
edit_redraw(was_current, FLOWING); if (openfile->current_y == 0 && ISSET(SMOOTH_SCROLL))
edit_scroll(BACKWARD);
else
edit_redraw(was_current, FLOWING);
/* <Up> should not change placewewant, so restore it. */ /* <Up> should not change placewewant, so restore it. */
openfile->placewewant = leftedge + target_column; openfile->placewewant = leftedge + target_column;
@ -515,7 +518,10 @@ void do_down(void)
set_proper_index_and_pww(&leftedge, target_column, TRUE); set_proper_index_and_pww(&leftedge, target_column, TRUE);
edit_redraw(was_current, FLOWING); if (openfile->current_y == editwinrows - 1 && ISSET(SMOOTH_SCROLL))
edit_scroll(FORWARD);
else
edit_redraw(was_current, FLOWING);
/* <Down> should not change placewewant, so restore it. */ /* <Down> should not change placewewant, so restore it. */
openfile->placewewant = leftedge + target_column; openfile->placewewant = leftedge + target_column;