]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.0643: terminal: cursor may end up on invalid position v9.1.0643
authorChristian Brabandt <cb@256bit.org>
Mon, 29 Jul 2024 19:19:51 +0000 (21:19 +0200)
committerChristian Brabandt <cb@256bit.org>
Mon, 29 Jul 2024 19:19:51 +0000 (21:19 +0200)
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>
src/terminal.c
src/version.c

index c681f3a432c35a1df86f787dcf1fc30292e12b7c..1fc0ef96881f9516fe67b6b7e46efea94b3f8d83 100644 (file)
@@ -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();
 }
 
 /*
index 153685953a2d4197c4f550d6c519f43eecef72d9..bfcb7bf8e38e53837d6c227376a05145274d68bd 100644 (file)
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    643,
 /**/
     642,
 /**/