commit 0d9080a22c922620570ed8fc8e4df1376f95fd1c
parent 1ae90e205aa5b1ff50dc6601dee526ee1581bfe2
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Sat, 14 Apr 2018 12:22:48 +0200
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>
Diffstat:
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/move.c b/src/move.c
@@ -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;