public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Jocelyn Falempe <jfalempe@redhat.com>
To: git-commits@fedoraproject.org
Subject: [rpms/libtsm] rawhide: Update to v4.6.0
Date: Tue, 30 Jun 2026 11:57:12 GMT [thread overview]
Message-ID: <178282063220.1.16097264969895382333.rpms-libtsm-643502313f1b@fedoraproject.org> (raw)
A new commit has been pushed.
Repo : rpms/libtsm
Branch : rawhide
Commit : 643502313f1b76e2480f6e66882c4a8a0b5f10cb
Author : Jocelyn Falempe <jfalempe@redhat.com>
Date : 2026-06-30T11:13:28+02:00
Stats : +201/-2 in 4 file(s)
URL : https://src.fedoraproject.org/rpms/libtsm/c/643502313f1b76e2480f6e66882c4a8a0b5f10cb?branch=rawhide
Log:
Update to v4.6.0
vte: map mouse wheel up/down buttons correctly by @mierenhoop in #45
fix CSI default parameter by @kdj0c in #47
vte: Fix ctrl+shift+arrows by @kdj0c in #49
Add a new draw2 interface by @kdj0c in #50
vte: Add dim support by @kdj0c in #51
Fix backward selection
---
diff --git a/.gitignore b/.gitignore
index 549ff06..2dd1196 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,3 +5,4 @@
/libtsm-4.4.2.tar.gz
/libtsm-4.4.3.tar.gz
/libtsm-4.5.0.tar.gz
+/libtsm-4.6.0.tar.gz
diff --git a/Fix-backward-selection.patch b/Fix-backward-selection.patch
new file mode 100644
index 0000000..ffcafad
--- /dev/null
+++ b/Fix-backward-selection.patch
@@ -0,0 +1,196 @@
+From 4e7200a4844c98a99318a7cb21f314b4915b9228 Mon Sep 17 00:00:00 2001
+From: Jocelyn Falempe <jfalempe@redhat.com>
+Date: Wed, 24 Jun 2026 23:28:08 +0200
+Subject: [PATCH] Fix backward selection
+
+When selecting with the mouse in backward direction, the selection takes
+only one char.
+This bug was introduced with the commit:
+e4c7bfd scrollback/selection: refactor scrollback and selection code
+
+So store the first click to its own selection (sel_begin) and then when
+the target change, make sure to correctly order sel_start and sel_end.
+---
+ src/tsm/libtsm-int.h | 5 +--
+ src/tsm/tsm-screen.c | 8 +++--
+ src/tsm/tsm-selection.c | 75 +++++++++++++++++------------------------
+ 3 files changed, 39 insertions(+), 49 deletions(-)
+
+diff --git a/src/tsm/libtsm-int.h b/src/tsm/libtsm-int.h
+index 16b7b88..bc6c381 100644
+--- a/src/tsm/libtsm-int.h
++++ b/src/tsm/libtsm-int.h
+@@ -153,8 +153,9 @@ struct tsm_screen {
+
+ /* selection */
+ bool sel_active;
+- struct selection_pos sel_start;
+- struct selection_pos sel_end;
++ struct selection_pos sel_begin; /* First cell selected */
++ struct selection_pos sel_start; /* First cell to copy in terminal order */
++ struct selection_pos sel_end; /* Last cell to copy */
+
+ /* draw2 interface */
+ struct tsm_screen_cell *cells;
+diff --git a/src/tsm/tsm-screen.c b/src/tsm/tsm-screen.c
+index 2ed815d..b6fab33 100644
+--- a/src/tsm/tsm-screen.c
++++ b/src/tsm/tsm-screen.c
+@@ -191,6 +191,8 @@ static void clear_selection_on_line(struct tsm_screen *con, struct line *line)
+ {
+ if (!con->sel_active)
+ return;
++ if (con->sel_begin.line == line)
++ con->sel_begin.line = NULL;
+ if (con->sel_start.line == line)
+ con->sel_start.line = NULL;
+ if (con->sel_end.line == line)
+@@ -259,7 +261,7 @@ static void remove_from_sb(struct tsm_screen *con, unsigned int num)
+
+ if (con->sb.pos == tmp) {
+ con->sb.pos_num = con->sb.count;
+- con->sb.pos = NULL;
++ con->sb.pos = NULL;
+ }
+ /*
+ * Copy the cells from the scrollback buffer to the line. scrollback buffer can have a different
+@@ -840,9 +842,11 @@ void tsm_screen_clear_sb(struct tsm_screen *con)
+ con->age = con->age_cnt;
+
+ if (con->sel_active) {
++ if (con->sel_begin.line && is_in_scrollback(&con->sel_begin))
++ con->sel_begin.line = NULL;
+ if (con->sel_start.line && is_in_scrollback(&con->sel_start))
+ con->sel_start.line = NULL;
+- if (con->sel_end.line && is_in_scrollback(&con->sel_end))
++ if (con->sel_end.line && is_in_scrollback(&con->sel_end))
+ con->sel_end.line = NULL;
+ }
+ shl_dlist_for_each_safe(iter, safe, &con->sb.list) {
+diff --git a/src/tsm/tsm-selection.c b/src/tsm/tsm-selection.c
+index 77168ef..a01b4db 100644
+--- a/src/tsm/tsm-selection.c
++++ b/src/tsm/tsm-selection.c
+@@ -175,55 +175,32 @@ static unsigned int copy_line(struct tsm_screen *con, struct line *line, char *b
+ return pos - buf;
+ }
+
+-static void swap_selections(struct tsm_screen *con)
+-{
+- struct selection_pos c;
+-
+- c = con->sel_start;
+- con->sel_start = con->sel_end;
+- con->sel_end = c;
+-}
+-
+ /*
+- * Normalize a selection
+- *
+- * Start must always point to the top left and end to the bottom right cell
++ * Returns true if a is before b in terminal order
+ */
+-static void norm_selection(struct tsm_screen *con)
++static bool selection_is_before(struct tsm_screen *con, struct selection_pos *a, struct selection_pos *b)
+ {
+ int i;
+- struct selection_pos *start, *end;
+
+- start = &con->sel_start;
+- end = &con->sel_end;
++ if (a->line == b->line)
++ return (a->x < b->x);
+
+- if (start->line == end->line) {
+- if (con->sel_start.x > con->sel_end.x)
+- swap_selections(con);
+- return;
+- }
+-
+- if (is_in_scrollback(&con->sel_start) != is_in_scrollback(&con->sel_end)) {
+- if (is_in_scrollback(&con->sel_end))
+- swap_selections(con);
+- return;
+- }
++ if (is_in_scrollback(a) != is_in_scrollback(b))
++ return (is_in_scrollback(a));
+
+- if (is_in_scrollback(&con->sel_start) && is_in_scrollback(&con->sel_end)) {
+- if (con->sel_start.line->sb_id > con->sel_end.line->sb_id)
+- swap_selections(con);
+- return;
+- }
++ if (is_in_scrollback(a) && is_in_scrollback(b))
++ return (a->line->sb_id < b->line->sb_id);
+
+- /* so both are not in scroll back buffer and can't be equal */
++ /* so both are not in scroll back buffer and are not on the same line */
+ for (i = 0; i < con->size_y; i++) {
+- if (con->lines[i] == con->sel_end.line) {
+- swap_selections(con);
+- return;
+- }
+- if (con->lines[i] == con->sel_start.line)
+- return;
++ if (con->lines[i] == b->line)
++ return false;
++
++ if (con->lines[i] == a->line)
++ return true;
+ }
++ // Should not happen
++ return true;
+ }
+
+ SHL_EXPORT
+@@ -239,8 +216,9 @@ void tsm_screen_selection_start(struct tsm_screen *con,
+ con->age = con->age_cnt;
+
+ con->sel_active = true;
+- selection_set(con, &con->sel_start, posx, posy);
+- memcpy(&con->sel_end, &con->sel_start, sizeof(con->sel_end));
++ selection_set(con, &con->sel_begin, posx, posy);
++ con->sel_start = con->sel_begin;
++ con->sel_end = con->sel_begin;
+ }
+
+ SHL_EXPORT
+@@ -248,6 +226,8 @@ void tsm_screen_selection_target(struct tsm_screen *con,
+ unsigned int posx,
+ unsigned int posy)
+ {
++ struct selection_pos target;
++
+ if (!con || !con->sel_active || posx >= con->size_x || posy >= con->size_y)
+ return;
+
+@@ -255,9 +235,14 @@ void tsm_screen_selection_target(struct tsm_screen *con,
+ /* TODO: more sophisticated ageing */
+ con->age = con->age_cnt;
+
+- selection_set(con, &con->sel_end, posx, posy);
+- /* always normalize the selection */
+- norm_selection(con);
++ selection_set(con, &target, posx, posy);
++ if (selection_is_before(con, &con->sel_begin, &target)) {
++ con->sel_start = con->sel_begin;
++ con->sel_end = target;
++ } else {
++ con->sel_start = target;
++ con->sel_end = con->sel_begin;
++ }
+ }
+
+ SHL_EXPORT
+@@ -284,7 +269,7 @@ void tsm_screen_selection_word(struct tsm_screen *con,
+ static unsigned int get_line_index(struct tsm_screen *con, struct line *line)
+ {
+ unsigned int i = 0;
+-
++
+ if (line->sb_id)
+ return 0;
+
+--
+2.54.0
+
diff --git a/libtsm.spec b/libtsm.spec
index 4f596e2..edc98ee 100644
--- a/libtsm.spec
+++ b/libtsm.spec
@@ -1,5 +1,5 @@
Name: libtsm
-Version: 4.5.0
+Version: 4.6.0
Release: %autorelease
Summary: DEC-VT terminal emulator state machine
License: MIT AND LGPL-2.1-or-later
@@ -12,6 +12,8 @@ BuildRequires: xz
BuildRequires: pkgconfig(xkbcommon)
BuildRequires: pkgconfig(check)
+Patch: Fix-backward-selection.patch
+
%description
TSM is a state machine for DEC VT100-VT520 compatible terminal
emulators. It can be used to implement terminal emulators, or other
diff --git a/sources b/sources
index d589667..8c9f060 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-SHA512 (libtsm-4.5.0.tar.gz) = 7138e1a25b2e062937dd8221e1adef4433ce597bb3f1c8b616a606c7e46b505e99c2b04ba403d80730f181c5c0fc2b275a5fecb6a46c096d079a783c17fc9523
+SHA512 (libtsm-4.6.0.tar.gz) = fef62d68a8f4f4a1266872c222a8eacaf527f0687dd03d7fefbf0b061ea8d8024c4f461451b494ad0b5cb83b1f6a29dde9de6c7a080b7a2590385ddd86d84c88
reply other threads:[~2026-06-30 11:57 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=178282063220.1.16097264969895382333.rpms-libtsm-643502313f1b@fedoraproject.org \
--to=jfalempe@redhat.com \
--cc=git-commits@fedoraproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox