summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Brabandt <cb@256bit.org>2024-07-29 21:19:51 +0200
committerChristian Brabandt <cb@256bit.org>2024-07-29 21:19:51 +0200
commit1254e6db8360fac99561ef0f10ac3cb1bfef30b1 (patch)
treee87afe8269ba35d38bdc01e393ec17c141b06a09
parent9d997addc7bd0fd132a809cf497ed816e61fcd25 (diff)
patch 9.1.0643: terminal: cursor may end up on invalid positionv9.1.0643
Problem: terminal: cursor may end up on invalid position after reducing the scrollback lines (user202729) Solution: After reducing the scrollback size, check the cursor position, making sure it does not end up on an invalid line fixes: #15351 Signed-off-by: Christian Brabandt <cb@256bit.org>
-rw-r--r--src/terminal.c4
-rw-r--r--src/version.c2
2 files changed, 6 insertions, 0 deletions
diff --git a/src/terminal.c b/src/terminal.c
index c681f3a432..1fc0ef9688 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -3451,6 +3451,10 @@ limit_scrollback(term_T *term, garray_T *gap, int update_buffer)
sizeof(sb_line_T) * gap->ga_len);
if (update_buffer)
term->tl_scrollback_scrolled -= todo;
+
+ // make sure cursor is on a valid line
+ if (curbuf == term->tl_buffer)
+ check_cursor();
}
/*
diff --git a/src/version.c b/src/version.c
index 153685953a..bfcb7bf8e3 100644
--- a/src/version.c
+++ b/src/version.c
@@ -705,6 +705,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 643,
+/**/
642,
/**/
641,