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>
This commit is contained in:
Benno Schulenberg 2018-04-14 12:22:48 +02:00
parent 1ae90e205a
commit 0d9080a22c

View File

@ -495,7 +495,10 @@ void do_up(void)
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. */
openfile->placewewant = leftedge + target_column;
@ -515,7 +518,10 @@ void do_down(void)
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. */
openfile->placewewant = leftedge + target_column;