patch 9.1.0643: terminal: cursor may end up on invalid position

Commit: 
https://github.com/vim/vim/commit/1254e6db8360fac99561ef0f10ac3cb1bfef30b1
Author: Christian Brabandt <c...@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 <c...@256bit.org>

diff --git a/src/terminal.c b/src/terminal.c
index c681f3a43..1fc0ef968 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 153685953..bfcb7bf8e 100644
--- a/src/version.c
+++ b/src/version.c
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    643,
 /**/
     642,
 /**/

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/E1sYW4J-001uRW-7z%40256bit.org.

Raspunde prin e-mail lui