summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames McCoy <jamessan@debian.org>2023-05-27 22:41:50 -0400
committerJames McCoy <jamessan@debian.org>2023-05-27 22:41:50 -0400
commit9f8764749af72ca1e316927b3dcb049084e52ed1 (patch)
treebb00f778454e4ae9267c1aad46a02119cc7b912c
parent5f3851ffac68d1523515eaa27e507805bbc118ff (diff)
New upstream version 0.3.2
-rw-r--r--Makefile2
-rw-r--r--src/screen.c14
-rw-r--r--t/69screen_reflow.test9
-rw-r--r--vterm.pc.in2
4 files changed, 22 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index 3f28d64..de2a174 100644
--- a/Makefile
+++ b/Makefile
@@ -40,7 +40,7 @@ VERSION_CURRENT=0
VERSION_REVISION=0
VERSION_AGE=0
-VERSION=0.3.1
+VERSION=0.3.2
PREFIX=/usr/local
BINDIR=$(PREFIX)/bin
diff --git a/src/screen.c b/src/screen.c
index 51c7f99..cda63fb 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -595,8 +595,15 @@ static void resize_buffer(VTermScreen *screen, int bufidx, int new_rows, int new
new_row_start, new_row_end, old_row_start, old_row_end, width);
#endif
- if(new_row_start < 0)
+ if(new_row_start < 0) {
+ if(old_row_start <= old_cursor.row && old_cursor.row < old_row_end) {
+ new_cursor.row = 0;
+ new_cursor.col = old_cursor.col;
+ if(new_cursor.col >= new_cols)
+ new_cursor.col = new_cols-1;
+ }
break;
+ }
for(new_row = new_row_start, old_row = old_row_start; new_row <= new_row_end; new_row++) {
int count = width >= new_cols ? new_cols : width;
@@ -660,8 +667,9 @@ static void resize_buffer(VTermScreen *screen, int bufidx, int new_rows, int new
if(old_row >= 0 && bufidx == BUFIDX_PRIMARY) {
/* Push spare lines to scrollback buffer */
- for(int row = 0; row <= old_row; row++)
- sb_pushline_from_row(screen, row);
+ if(screen->callbacks && screen->callbacks->sb_pushline)
+ for(int row = 0; row <= old_row; row++)
+ sb_pushline_from_row(screen, row);
if(active)
statefields->pos.row -= (old_row + 1);
}
diff --git a/t/69screen_reflow.test b/t/69screen_reflow.test
index 278cc5b..eb7e4e4 100644
--- a/t/69screen_reflow.test
+++ b/t/69screen_reflow.test
@@ -77,3 +77,12 @@ RESIZE 5,16
?lineinfo 3 =
?screen_row 3 = "> "
?cursor = 3,2
+
+!Cursor goes missing
+# For more context: https://github.com/neovim/neovim/pull/21124
+RESET
+RESIZE 5,5
+RESIZE 3,1
+PUSH "\x1b[2;1Habc\r\n\x1b[H"
+RESIZE 1,1
+ ?cursor = 0,0
diff --git a/vterm.pc.in b/vterm.pc.in
index 681a270..bcb5ce4 100644
--- a/vterm.pc.in
+++ b/vterm.pc.in
@@ -3,6 +3,6 @@ includedir=@INCDIR@
Name: vterm
Description: Abstract VT220/Xterm/ECMA-48 emulation library
-Version: 0.3.1
+Version: 0.3.2
Libs: -L${libdir} -lvterm
Cflags: -I${includedir}