changeset 35850:f522747a3e9c v9.1.0643

patch 9.1.0643: terminal: cursor may end up on invalid position Commit: https://github.com/vim/vim/commit/1254e6db8360fac99561ef0f10ac3cb1bfef30b1 Author: Christian Brabandt <cb@256bit.org> Date: Mon Jul 29 21:19:51 2024 +0200 patch 9.1.0643: terminal: cursor may end up on invalid position 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>
author Christian Brabandt <cb@256bit.org>
date Mon, 29 Jul 2024 21:30:03 +0200
parents a05d18dad369
children a3bbe0b9d503
files src/terminal.c src/version.c
diffstat 2 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -3451,6 +3451,10 @@ limit_scrollback(term_T *term, garray_T 
 	    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();
 }
 
 /*
--- 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,