From 1be41aff8b66c7e69d76b235dcf01d656de8a190 Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Sun, 28 Dec 2025 21:20:58 +0100 Subject: [PATCH] fix: don't use with_selection_const in primary_drag with_selection_const destroys the selection on movement errors. closes #406 --- src/tui/editor.zig | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/tui/editor.zig b/src/tui/editor.zig index f4be723..305a3e6 100644 --- a/src/tui/editor.zig +++ b/src/tui/editor.zig @@ -2662,21 +2662,21 @@ pub const Editor = struct { .word => { if (sel.is_reversed()) { sel.begin = initial.end; - with_selection_const(root, move_cursor_word_begin, primary, self.metrics) catch {}; + move_cursor_word_begin(root, &sel.end, self.metrics) catch {}; } else { sel.begin = initial.begin; - with_selection_const(root, move_cursor_word_end, primary, self.metrics) catch {}; + move_cursor_word_end(root, &sel.end, self.metrics) catch {}; } }, .line => { if (sel.is_reversed()) { sel.begin = initial.end; - with_selection_const(root, move_cursor_begin, primary, self.metrics) catch {}; + move_cursor_begin(root, &sel.end, self.metrics) catch {}; } else { sel.begin = initial.begin; blk: { - with_selection_const(root, move_cursor_end, primary, self.metrics) catch break :blk; - with_selection_const(root, move_cursor_right, primary, self.metrics) catch {}; + move_cursor_end(root, &sel.end, self.metrics) catch break :blk; + move_cursor_right(root, &sel.end, self.metrics) catch {}; } } },