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

git pushed a commit to branch tymux-12-session-parity
in repository terminology.

View the commit online.

commit 7a75d6f08165f7b80385776093abdf2136842ffc
Author: Cedric BAIL <[email protected]>
AuthorDate: Sun Nov 22 19:30:32 2026 -0600

    termtymux: give the session its size back on resume
    
    The daemon ignores the resizes of a paused client, and a native client
    did not send its size again when it got control back. After a hijacker
    of another size left, the session kept that size until the terminal
    was next resized. The inline proxy already resends it on resume.
---
 src/bin/termtymux.c    |  7 +++++++
 src/bin/termtymux.h    |  2 ++
 src/bin/tytest.c       |  1 +
 src/bin/tytest_tymux.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
 src/bin/tytest_tymux.h |  1 +
 tests/meson.build      |  2 +-
 6 files changed, 62 insertions(+), 1 deletion(-)

diff --git a/src/bin/termtymux.c b/src/bin/termtymux.c
index ede5033b..9d7c3a96 100644
--- a/src/bin/termtymux.c
+++ b/src/bin/termtymux.c
@@ -835,6 +835,9 @@ _msg_handle(TermTymux *ts, int type, void *payload, uint32_t size, int fd)
         break;
       case TSRV_MSG_RESUME:
         ts->paused = EINA_FALSE;
+        /* the hijacker may have left another size on the session */
+        if (ts->last_cols > 0 && ts->last_rows > 0)
+          termtymux_resize(ts, ts->last_cols, ts->last_rows);
         if (ts->cb_pause.func) ts->cb_pause.func(ts->cb_pause.data, EINA_FALSE);
         break;
       default:
@@ -1006,6 +1009,8 @@ termtymux_new(const char *name, int cols, int rows, Config *config,
         return NULL;
      }
    ts->sock_fd = sock;
+   ts->last_cols = cols;
+   ts->last_rows = rows;
    ts->shm = shm;
    ts->shadow_pty = ty;
    ty->backlog_view = ts->view;
@@ -1219,6 +1224,8 @@ termtymux_resize(TermTymux *ts, int cols, int rows)
    TermSrvMsgResize resize;
 
    EINA_SAFETY_ON_NULL_RETURN(ts);
+   ts->last_cols = cols;
+   ts->last_rows = rows;
    if (ts->sock_fd < 0) return;
 
    resize.cols = (uint32_t)cols;
diff --git a/src/bin/termtymux.h b/src/bin/termtymux.h
index 7bc95b37..cc732dfa 100644
--- a/src/bin/termtymux.h
+++ b/src/bin/termtymux.h
@@ -56,6 +56,8 @@ struct _TermTymux
         void (*func) (void *data, Eina_Bool paused);
         void *data;
      } cb_pause;                  /* fires whenever ->paused changes */
+   /* seeded by termtymux_new(), updated by termtymux_resize() */
+   int               last_cols, last_rows;
    BacklogView      *view;        /* the scrollback of the shadow pty */
    uint32_t          backlog_first_id; /* the daemon's oldest page */
 };
diff --git a/src/bin/tytest.c b/src/bin/tytest.c
index c4aaddf9..cdfb7c84 100644
--- a/src/bin/tytest.c
+++ b/src/bin/tytest.c
@@ -334,6 +334,7 @@ static const struct {
        { "tymux_live_paste", tytest_tymux_live_paste},
        { "tymux_live_pages_read_only", tytest_tymux_live_pages_read_only},
        { "tymux_live_focus_restores", tytest_tymux_live_focus_restores},
+       { "tymux_live_resume_size", tytest_tymux_live_resume_size},
 #endif
        { NULL, NULL},
 };
diff --git a/src/bin/tytest_tymux.c b/src/bin/tytest_tymux.c
index 92a93ffa..b8e1f64a 100644
--- a/src/bin/tytest_tymux.c
+++ b/src/bin/tytest_tymux.c
@@ -2381,3 +2381,53 @@ tytest_tymux_live_focus_restores(void)
 {
    return tytest_tymux_live_run(_focus_restores_body);
 }
+
+typedef struct
+{
+   Termpty *ty;
+   int cols;
+   int rows;
+} Size;
+
+static Eina_Bool
+_size_done(void *data)
+{
+   Size *size = data;
+
+   return size->ty->w == size->cols && size->ty->h == size->rows;
+}
+
+/* A client that resumes after a hijack gives the session its size back:
+ * the hijacker's size must not stick. */
+static int
+_live_resume_size_body(void)
+{
+   TermTymux *ts_a, *ts_b;
+   Termpty *ty_a, *ty_b;
+
+   assert(tytest_tymux_start(SESSION, 80, 24, &ts_a, &ty_a));
+   termtymux_resize(ts_a, 80, 24);
+   assert(tytest_tymux_wait(_size_done, &(Size){ ty_a, 80, 24 }, 5.0));
+
+   assert(tytest_tymux_start(SESSION, 100, 30, &ts_b, &ty_b));
+   termtymux_resize(ts_b, 100, 30);
+   assert(tytest_tymux_wait(_size_done, &(Size){ ty_b, 100, 30 }, 5.0));
+   assert(tytest_tymux_wait(_size_done, &(Size){ ty_a, 100, 30 }, 5.0));
+
+   /* the daemon ignores a paused client's resize: only the resend below
+    * can give the session this size. Let the daemon read it while A is
+    * still paused, not after B's detach. */
+   termtymux_resize(ts_a, 90, 20);
+   tytest_tymux_wait(_never_done, NULL, 0.3);
+   termtymux_free(ts_b);
+   assert(tytest_tymux_wait(_size_done, &(Size){ ty_a, 90, 20 }, 5.0));
+
+   tytest_tymux_stop(ts_a);
+   return 0;
+}
+
+int
+tytest_tymux_live_resume_size(void)
+{
+   return tytest_tymux_live_run(_live_resume_size_body);
+}
diff --git a/src/bin/tytest_tymux.h b/src/bin/tytest_tymux.h
index c897690b..3668586a 100644
--- a/src/bin/tytest_tymux.h
+++ b/src/bin/tytest_tymux.h
@@ -59,5 +59,6 @@ int tytest_tymux_live_page_async(void);
 int tytest_tymux_live_paste(void);
 int tytest_tymux_live_pages_read_only(void);
 int tytest_tymux_live_focus_restores(void);
+int tytest_tymux_live_resume_size(void);
 
 #endif
diff --git a/tests/meson.build b/tests/meson.build
index dd47eb4f..13d71c80 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -107,7 +107,7 @@ if tests
                 'tymux_live_scrollback_zero', 'tymux_live_fd_budget',
                 'tymux_live_fd_starved',
                 'tymux_live_page_async', 'tymux_live_paste',
-                'tymux_live_pages_read_only'],
+                'tymux_live_pages_read_only', 'tymux_live_resume_size'],
          depends: [tymuxd],
          timeout: 120)
     # Waits for the daemon to find its session quiet: apart, so that it

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

Reply via email to