From 772e2e7d298dfc8c1c7e5549ea77de3d54a6a101 Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Thu, 30 Oct 2025 11:16:41 +0100 Subject: [PATCH] refactor: use select_line_at_cursor to simplify cut command --- src/tui/editor.zig | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/src/tui/editor.zig b/src/tui/editor.zig index f8e87bc..b6f3087 100644 --- a/src/tui/editor.zig +++ b/src/tui/editor.zig @@ -2698,19 +2698,8 @@ pub const Editor = struct { const primary = self.get_primary(); const b = self.buf_for_update() catch return; var root = b.root; - if (self.cursels.items.len == 1) - if (primary.selection) |_| {} else { - const sel = primary.enable_selection(root, self.metrics) catch return; - try move_cursor_begin(root, &sel.begin, self.metrics); - move_cursor_end(root, &sel.end, self.metrics) catch |e| switch (e) { - error.Stop => {}, - else => return e, - }; - move_cursor_right(root, &sel.end, self.metrics) catch |e| switch (e) { - error.Stop => {}, - else => return e, - }; - }; + if (self.cursels.items.len == 1 and primary.selection == null) + try self.select_line_at_cursor(root, primary, .include_eol); var count: usize = 0; for (self.cursels.items) |*cursel_| if (cursel_.*) |*cursel| { count += 1;