mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-06-15 16:13:56 +00:00
terminal: test Screen.select frees existing pins
This commit is contained in:
@@ -7652,6 +7652,32 @@ test "Screen: select untracked" {
|
||||
try testing.expectEqual(tracked, s.pages.countTrackedPins());
|
||||
}
|
||||
|
||||
test "Screen: select replaces existing pins" {
|
||||
const testing = std.testing;
|
||||
const alloc = testing.allocator;
|
||||
|
||||
var s = try init(alloc, .{ .cols = 10, .rows = 10, .max_scrollback = 0 });
|
||||
defer s.deinit();
|
||||
try s.testWriteString("ABC DEF\n 123\n456");
|
||||
|
||||
const tracked = s.pages.countTrackedPins();
|
||||
try s.select(Selection.init(
|
||||
s.pages.pin(.{ .active = .{ .x = 0, .y = 0 } }).?,
|
||||
s.pages.pin(.{ .active = .{ .x = 3, .y = 0 } }).?,
|
||||
false,
|
||||
));
|
||||
try testing.expectEqual(tracked + 2, s.pages.countTrackedPins());
|
||||
|
||||
// Replacing the selection must untrack the prior selection's pins
|
||||
// rather than leak them.
|
||||
try s.select(Selection.init(
|
||||
s.pages.pin(.{ .active = .{ .x = 0, .y = 1 } }).?,
|
||||
s.pages.pin(.{ .active = .{ .x = 2, .y = 1 } }).?,
|
||||
false,
|
||||
));
|
||||
try testing.expectEqual(tracked + 2, s.pages.countTrackedPins());
|
||||
}
|
||||
|
||||
test "Screen: selectAll" {
|
||||
const testing = std.testing;
|
||||
const alloc = testing.allocator;
|
||||
|
||||
Reference in New Issue
Block a user