terminal: only set selection dirty to true on clear if previously set

This commit is contained in:
Mitchell Hashimoto
2024-05-06 18:35:51 -07:00
parent 26300447e4
commit d3abe65ad6

View File

@ -1344,9 +1344,11 @@ pub fn select(self: *Screen, sel_: ?Selection) !void {
/// Same as select(null) but can't fail. /// Same as select(null) but can't fail.
pub fn clearSelection(self: *Screen) void { pub fn clearSelection(self: *Screen) void {
if (self.selection) |*sel| sel.deinit(self); if (self.selection) |*sel| {
sel.deinit(self);
self.dirty.selection = true;
}
self.selection = null; self.selection = null;
self.dirty.selection = true;
} }
pub const SelectionString = struct { pub const SelectionString = struct {