Skip to content

Commit 6bb18a8

Browse files
committed
patch 8.0.0938: scrolling in terminal window is inefficient
Problem: Scrolling in terminal window is inefficient. Solution: Use win_del_lines().
1 parent bce4f62 commit 6bb18a8

2 files changed

Lines changed: 14 additions & 7 deletions

File tree

src/terminal.c

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,6 @@
3838
* in tl_scrollback are no longer used.
3939
*
4040
* TODO:
41-
* - add a character in :ls output
42-
* - add 't' to mode()
43-
* - use win_del_lines() to make scroll-up efficient.
44-
* - Make StatusLineTerm adjust UserN highlighting like StatusLineNC does, see
45-
* use of hightlight_stlnc[].
4641
* - implement term_setsize()
4742
* - add test for giving error for invalid 'termsize' value.
4843
* - support minimal size when 'termsize' is "rows*cols".
@@ -1495,11 +1490,21 @@ handle_damage(VTermRect rect, void *user)
14951490
}
14961491

14971492
static int
1498-
handle_moverect(VTermRect dest UNUSED, VTermRect src UNUSED, void *user)
1493+
handle_moverect(VTermRect dest, VTermRect src, void *user)
14991494
{
15001495
term_T *term = (term_T *)user;
1496+
win_T *wp;
15011497

1502-
/* TODO */
1498+
if (dest.start_col == src.start_col
1499+
&& dest.end_col == src.end_col
1500+
&& dest.start_row < src.start_row)
1501+
FOR_ALL_WINDOWS(wp)
1502+
{
1503+
if (wp->w_buffer == term->tl_buffer)
1504+
/* scrolling up is much more efficient when deleting lines */
1505+
win_del_lines(wp, dest.start_row,
1506+
src.start_row - dest.start_row, FALSE, FALSE);
1507+
}
15031508
redraw_buf_later(term->tl_buffer, NOT_VALID);
15041509
return 1;
15051510
}

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -769,6 +769,8 @@ static char *(features[]) =
769769

770770
static int included_patches[] =
771771
{ /* Add new patch number below this line */
772+
/**/
773+
938,
772774
/**/
773775
937,
774776
/**/

0 commit comments

Comments
 (0)