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,10 +1344,12 @@ pub fn select(self: *Screen, sel_: ?Selection) !void {
/// Same as select(null) but can't fail.
pub fn clearSelection(self: *Screen) void {
if (self.selection) |*sel| sel.deinit(self);
self.selection = null;
if (self.selection) |*sel| {
sel.deinit(self);
self.dirty.selection = true;
}
self.selection = null;
}
pub const SelectionString = struct {
/// The selection to convert to a string.