This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch tymux-10-quiet-head
in repository terminology.

View the commit online.

commit d901b7a84b1da0a23c94f0ce3b9b41d510d2b627
Author: Boris Faure <[email protected]>
AuthorDate: Thu Nov 12 16:24:14 2026 +0000

    termptyops: keep the top margin when a region scrolls down to the last row
    
    DECSTBM stores a bottom margin on the last row as 0, and
    termpty_text_scroll_rev() only read the top margin when the bottom one
    was set. SD, and RI at the top margin, in a region such as 3;24 on a
    24-row screen thus scrolled the whole screen, moving the rows above the
    region. Scrolling up already took the top margin alone.
---
 src/bin/termptyops.c         |  7 ++-----
 tests/sd-region-to-bottom.sh | 24 ++++++++++++++++++++++++
 tests/tests.results          |  1 +
 3 files changed, 27 insertions(+), 5 deletions(-)

diff --git a/src/bin/termptyops.c b/src/bin/termptyops.c
index 297aed4b..8767ff08 100644
--- a/src/bin/termptyops.c
+++ b/src/bin/termptyops.c
@@ -115,13 +115,10 @@ void
 termpty_text_scroll_rev(Termpty *ty, Eina_Bool clear)
 {
    Termcell *cells;
-   int start_y = 0, end_y = ty->h - 1;
+   int start_y = ty->termstate.top_margin, end_y = ty->h - 1;
 
    if (ty->termstate.bottom_margin != 0)
-     {
-        start_y = ty->termstate.top_margin;
-        end_y = ty->termstate.bottom_margin - 1;
-     }
+     end_y = ty->termstate.bottom_margin - 1;
    DBG("... scroll rev!!!!! [%i->%i]", start_y, end_y);
    termio_scroll(ty->obj, 1, start_y, end_y);
 
diff --git a/tests/sd-region-to-bottom.sh b/tests/sd-region-to-bottom.sh
new file mode 100755
index 00000000..c521f437
--- /dev/null
+++ b/tests/sd-region-to-bottom.sh
@@ -0,0 +1,24 @@
+#!/bin/sh
+# shellcheck source=tests/utils.sh
+. "$(dirname "$0")/utils.sh"
+
+# SD and RI in a scroll region that ends on the last row: the rows above
+# the region must not move
+
+printf '\033[2J\033[H'
+i=1
+while [ "$i" -le 24 ]; do
+   printf '\033[%d;1Hrow %02d' "$i" "$i"
+   i=$((i + 1))
+done
+
+# DECSTBM to the last row, then SD
+printf '\033[3;24r\033[2T'
+
+# RI at the top margin
+printf '\033[3;1H\033M'
+
+# a bottom margin given as the screen height or past it
+printf '\033[6;99r\033[T\033[6;1H\033M'
+
+printf '\033[r\033[H'
diff --git a/tests/tests.results b/tests/tests.results
index e7f292f5..5e36c00c 100644
--- a/tests/tests.results
+++ b/tests/tests.results
@@ -232,3 +232,4 @@ irm-runs.sh d3a480e2a58939db077a06b95712371a
 xterm-osc-9.sh 09d136a6b7f579c0d23e95f406f65bf4
 xterm-osc-9-4.sh 5e1e81fce6d8d7dbe261ea21ed2491b8
 xterm-osc-9-4-reset.sh 418469754b84535141326790ebf8e941
+sd-region-to-bottom.sh a102ef27ade17a979473302b02ae78ea

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to