Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package libtsm for openSUSE:Factory checked in at 2026-11-27 19:45:24 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libtsm (Old) and /work/SRC/openSUSE:Factory/.libtsm.new.1340718 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libtsm" Fri Nov 27 19:45:24 2026 rev:12 rq:1401168 version:4.8.1 Changes: -------- --- /work/SRC/openSUSE:Factory/libtsm/libtsm.changes 2026-09-28 13:47:51.868939873 +0200 +++ /work/SRC/openSUSE:Factory/.libtsm.new.1340718/libtsm.changes 2026-11-27 19:49:43.200797787 +0100 @@ -1,0 +2,9 @@ +Fri Nov 27 09:01:55 UTC 2026 - Fabian Vogt <[email protected]> + +- Update to 4.8.1: + * vte: Fix XTQMODKEYS interpreted has SGR 4 underline + * Fix missing NULL checks, SHL_EXPORT, and out-of-bounds read + * vte: keep mouse tracking, motion and encoding modes independent +- Fix typo in previous changelog entry + +------------------------------------------------------------------- @@ -4 +13 @@ -- Updaet to 4.8.0: +- Update to 4.8.0: Old: ---- v4.8.0.tar.gz New: ---- v4.8.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libtsm.spec ++++++ --- /var/tmp/diff_new_pack.Qscg8I/_old 2026-11-27 19:49:44.615857867 +0100 +++ /var/tmp/diff_new_pack.Qscg8I/_new 2026-11-27 19:49:44.619858037 +0100 @@ -19,7 +19,7 @@ %global sover 4 %global lname libtsm%{sover} Name: libtsm -Version: 4.8.0 +Version: 4.8.1 Release: 0 Summary: DEC-VT terminal emulator state machine License: LGPL-2.1-or-later AND MIT ++++++ v4.8.0.tar.gz -> v4.8.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libtsm-4.8.0/NEWS.md new/libtsm-4.8.1/NEWS.md --- old/libtsm-4.8.0/NEWS.md 2026-09-25 15:08:08.000000000 +0200 +++ new/libtsm-4.8.1/NEWS.md 2026-11-26 20:11:30.000000000 +0100 @@ -1,5 +1,14 @@ # libtsm Release News +## CHANGES WITH 4.8.1 +* vte: Fix XTQMODKEYS interpreted has SGR 4 underline by @kdj0c in https://github.com/kmscon/libtsm/pull/71 +* Fix missing NULL checks, SHL_EXPORT, and out-of-bounds read by @0x5t4l1n in https://github.com/kmscon/libtsm/pull/72 +* vte: keep mouse tracking, motion and encoding modes independent by @quatr3ll in https://github.com/kmscon/libtsm/pull/75 + +## New Contributors +* @0x5t4l1n made their first contribution in https://github.com/kmscon/libtsm/pull/72 +* @quatr3ll made their first contribution in https://github.com/kmscon/libtsm/pull/75 + ## CHANGES WITH 4.8.0 * vte: don't emit double escape for meta+arrow keys by @perryprog in https://github.com/kmscon/libtsm/pull/67 * cursor blinking rate feature by @fnnFox in https://github.com/kmscon/libtsm/pull/68 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libtsm-4.8.0/meson.build new/libtsm-4.8.1/meson.build --- old/libtsm-4.8.0/meson.build 2026-09-25 15:08:08.000000000 +0200 +++ new/libtsm-4.8.1/meson.build 2026-11-26 20:11:30.000000000 +0100 @@ -3,7 +3,7 @@ project( 'libtsm', 'c', - version: '4.8.0', + version: '4.8.1', license: 'MIT', meson_version: '>=1.1', default_options: [ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libtsm-4.8.0/src/tsm/tsm-selection.c new/libtsm-4.8.1/src/tsm/tsm-selection.c --- old/libtsm-4.8.0/src/tsm/tsm-selection.c 2026-09-25 15:08:08.000000000 +0200 +++ new/libtsm-4.8.1/src/tsm/tsm-selection.c 2026-11-26 20:11:30.000000000 +0100 @@ -95,7 +95,7 @@ line = con->sel_start.line; - if (!line || line->cells[posx].ch == ' ') + if (!line || posx >= line->size || line->cells[posx].ch == ' ') return; for (start = posx; start >= 0; start--) { @@ -114,6 +114,8 @@ break; } } + if (end >= line->size) + end = line->size - 1; con->sel_start.x = start; con->sel_end.x = end; con->sel_end.line = line; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libtsm-4.8.0/src/tsm/tsm-vte.c new/libtsm-4.8.1/src/tsm/tsm-vte.c --- old/libtsm-4.8.0/src/tsm/tsm-vte.c 2026-09-25 15:08:08.000000000 +0200 +++ new/libtsm-4.8.1/src/tsm/tsm-vte.c 2026-11-26 20:11:30.000000000 +0100 @@ -175,6 +175,12 @@ void *mouse_data; unsigned int mouse_mode; unsigned int mouse_event; + /* DECSET 9/1000 (tracking), 1002/1003 (motion) and 1006/1016 + * (encoding) are independent modes; keep each one separately and + * derive mouse_mode/mouse_event from them in vte_update_mouse(). */ + unsigned int mouse_track; + unsigned int mouse_motion; + unsigned int mouse_enc; unsigned int mouse_last_col; unsigned int mouse_last_row; bool bracketed_paste; @@ -871,6 +877,9 @@ vte->mouse_mode = 0; vte->mouse_event = 0; + vte->mouse_track = 0; + vte->mouse_motion = 0; + vte->mouse_enc = 0; vte->mouse_last_col = 0; vte->mouse_last_row = 0; @@ -1600,6 +1609,36 @@ vte->flags &= ~flag; } + +static void vte_update_mouse(struct tsm_vte *vte) +{ + unsigned int mode, event; + + mode = vte->mouse_enc ? vte->mouse_enc : vte->mouse_track; + /* an encoding alone (e.g. only 1006 set) does not enable reporting */ + if (!vte->mouse_track && !vte->mouse_motion) + mode = 0; + + if (mode == TSM_VTE_MOUSE_MODE_X10 || mode == TSM_VTE_MOUSE_MODE_VT200) + event = TSM_VTE_MOUSE_EVENT_BTN; + else if (vte->mouse_motion) + event = vte->mouse_motion; + else if (vte->mouse_track) + event = TSM_VTE_MOUSE_EVENT_BTN; + else + event = 0; + + if (mode == vte->mouse_mode && event == vte->mouse_event) + return; + + vte->mouse_mode = mode; + vte->mouse_event = event; + if (vte->mouse_cb) + vte->mouse_cb(vte, vte->mouse_event, + vte->mouse_mode == TSM_VTE_MOUSE_MODE_PIXEL, + vte->mouse_data); +} + static void csi_mode(struct tsm_vte *vte, bool set) { unsigned int i; @@ -1704,12 +1743,11 @@ continue; case TSM_VTE_MOUSE_MODE_X10: case TSM_VTE_MOUSE_MODE_VT200: - vte->mouse_mode = set ? vte->csi_argv[i] : 0; - vte->mouse_event = TSM_VTE_MOUSE_EVENT_BTN; - - if (vte->mouse_cb) { - vte->mouse_cb(vte, vte->mouse_event, false, vte->mouse_data); - } + if (set) + vte->mouse_track = vte->csi_argv[i]; + else if (vte->mouse_track == (unsigned int)vte->csi_argv[i]) + vte->mouse_track = 0; + vte_update_mouse(vte); continue; case 12: /* blinking cursor */ /* TODO: implement */ @@ -1796,39 +1834,19 @@ continue; case TSM_VTE_MOUSE_EVENT_BTN: case TSM_VTE_MOUSE_EVENT_ANY: - if (vte->mouse_mode == TSM_VTE_MOUSE_MODE_X10 || vte->mouse_mode == TSM_VTE_MOUSE_MODE_VT200) { - vte->mouse_event = TSM_VTE_MOUSE_EVENT_BTN; - } else { - vte->mouse_event = set ? vte->csi_argv[i] : 0; - } - - if (vte->mouse_cb && vte->mouse_mode) { - vte->mouse_cb(vte, vte->mouse_event, vte->mouse_mode == TSM_VTE_MOUSE_MODE_PIXEL, vte->mouse_data); - } + if (set) + vte->mouse_motion = vte->csi_argv[i]; + else if (vte->mouse_motion == (unsigned int)vte->csi_argv[i]) + vte->mouse_motion = 0; + vte_update_mouse(vte); continue; case TSM_VTE_MOUSE_MODE_SGR: - vte->mouse_mode = set ? vte->csi_argv[i] : 0; - - if (!vte->mouse_cb) { - continue; - } - - if (!set || vte->mouse_event) { - vte->mouse_cb(vte, vte->mouse_event, false, vte->mouse_data); - continue; - } - continue; case TSM_VTE_MOUSE_MODE_PIXEL: - vte->mouse_mode = set ? vte->csi_argv[i] : 0; - - if (!vte->mouse_cb) { - continue; - } - - if (!set || vte->mouse_event) { - vte->mouse_cb(vte, vte->mouse_event, set, vte->mouse_data); - continue; - } + if (set) + vte->mouse_enc = vte->csi_argv[i]; + else if (vte->mouse_enc == (unsigned int)vte->csi_argv[i]) + vte->mouse_enc = 0; + vte_update_mouse(vte); continue; case TSM_VTE_BRACKETED_PASTE: vte->bracketed_paste = set; @@ -2024,7 +2042,7 @@ /* CSI_GT ('>' prefix) marks a private/DEC sequence such as * XTMODKEYS \033[>4;1m — not an SGR attribute. Guard against * misinterpreting it as e.g. SGR 4 (underline). */ - if (!(vte->csi_flags & CSI_GT)) + if (!(vte->csi_flags & (CSI_GT | CSI_WHAT))) csi_attribute(vte); break; case 'p': @@ -2782,6 +2800,9 @@ SHL_EXPORT void tsm_vte_set_backspace_sends_delete(struct tsm_vte *vte, bool enable) { + if (!vte) + return; + vte->backspace_sends_delete = enable; } @@ -3413,13 +3434,19 @@ return false; } +SHL_EXPORT bool tsm_vte_handle_mouse(struct tsm_vte *vte, unsigned int cell_x, unsigned int cell_y, unsigned int pixel_x, unsigned int pixel_y, unsigned int button, unsigned int event, unsigned char modifiers) { char buffer[24]; unsigned char reply_flags = 0; - bool pressed = event & TSM_MOUSE_EVENT_PRESSED; + bool pressed; + + if (!vte) + return false; + + pressed = event & TSM_MOUSE_EVENT_PRESSED; /* drop move event if we don't wait for move events */ /* In mode 1002 (BTN), accept MOVED with button pressed (drag, button >= 32) */ @@ -3520,6 +3547,7 @@ return false; } +SHL_EXPORT void tsm_vte_paste(struct tsm_vte *vte, const char *data) { if (!vte || !data) @@ -3529,7 +3557,7 @@ const char start[] = "\e[200~"; const char end[] = "\e[201~"; char *buf; - int len; + size_t len; len = strlen(data) + sizeof(start) + sizeof(end) + 1; buf = malloc(len); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libtsm-4.8.0/test/test_vte_mouse.c new/libtsm-4.8.1/test/test_vte_mouse.c --- old/libtsm-4.8.0/test/test_vte_mouse.c 2026-09-25 15:08:08.000000000 +0200 +++ new/libtsm-4.8.1/test/test_vte_mouse.c 2026-11-26 20:11:30.000000000 +0100 @@ -257,6 +257,43 @@ } END_TEST +START_TEST(test_mouse_sgr_drag_encoding_first) +{ + char *msg; + char *expected; + int r; + + /* tmux enables the encoding first and the tracking modes after it: + * 1000/1002 must not replace the SGR encoding set by 1006 */ + msg = "\e[?1006h\e[?1000h\e[?1002h"; + tsm_vte_input(vte, msg, strlen(msg)); + + tsm_vte_handle_mouse(vte, 0, 0, 0, 0, TSM_MOUSE_BUTTON_LEFT, TSM_MOUSE_EVENT_PRESSED, 0); + expected = "\e[<0;1;1M"; + r = memcmp(&write_buffer, expected, strlen(expected)); + ck_assert_int_eq(r, 0); + + /* drag with the left button held is reported as button 32 */ + memset(&write_buffer, 0, sizeof(write_buffer)); + tsm_vte_handle_mouse(vte, 4, 0, 0, 0, 32, TSM_MOUSE_EVENT_MOVED, 0); + expected = "\e[<32;5;1M"; + r = memcmp(&write_buffer, expected, strlen(expected)); + ck_assert_int_eq(r, 0); + + memset(&write_buffer, 0, sizeof(write_buffer)); + tsm_vte_handle_mouse(vte, 4, 0, 0, 0, TSM_MOUSE_BUTTON_LEFT, TSM_MOUSE_EVENT_RELEASED, 0); + expected = "\e[<0;5;1m"; + r = memcmp(&write_buffer, expected, strlen(expected)); + ck_assert_int_eq(r, 0); + + /* resetting the encoding falls back to the legacy one, tracking stays */ + memset(&write_buffer, 0, sizeof(write_buffer)); + msg = "\e[?1006l"; + tsm_vte_input(vte, msg, strlen(msg)); + ck_assert_int_eq(tsm_vte_get_mouse_mode(vte), TSM_VTE_MOUSE_MODE_VT200); +} +END_TEST + START_TEST(test_mouse_cb_pixels) { char *msg; @@ -324,6 +361,7 @@ TEST(test_mouse_cb_sgr) TEST(test_mouse_sgr) TEST(test_mouse_sgr_cell_change) + TEST(test_mouse_sgr_drag_encoding_first) TEST_END_CASE TEST_DEFINE_CASE(tests_sgr_pixels)
