From 2b0d9d607094739133470c10af51fd670cd63ed3 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 21 Oct 2026 21:05:10 -0300 Subject: A drag started on a file's line numbers copies only the text --- src/pardes.zig | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/pardes.zig') diff --git a/src/pardes.zig b/src/pardes.zig index 7e166847..2a94c0f0 100644 --- a/src/pardes.zig +++ b/src/pardes.zig @@ -9001,6 +9001,19 @@ test "board heap: every allocation failure during boot is a clean OutOfMemory" { ); } +test "a sweep pressed on the line numbers copies only the text" { + const p = try Pardes.init(std.testing.allocator, .{ .cols = 60, .rows = 12 }); + defer p.deinit(); + const pane = try p.setTestFile("alpha beta\ngamma delta\n"); + const numbers: i32 = panes.File.gutterWidth(pane); + const top: i32 = pane.tag_rows; + pane.sel[0] = .{ .state = .done, .c0 = 1, .c1 = numbers + 4, .r0 = top, .r1 = top + 1 }; + // Live, while the drag is held, and captured, once it is released. + try std.testing.expectEqualStrings("alpha beta\ngamma", try edit.selectionText(p, pane, pane.sel[0])); + try edit.capturePointerSelection(p, pane, 0); + try std.testing.expectEqualStrings("alpha beta\ngamma", try edit.selectionText(p, pane, pane.sel[0])); +} + test "jump history clears selections and lands at the recorded cursor" { const p = try Pardes.init(std.testing.allocator, .{ .cols = 60, .rows = 12 }); defer p.deinit(); -- cgit v1.3