mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 08:46:08 +03:00
terminal: Screen selection marks dirty
This commit is contained in:
@ -795,6 +795,11 @@ pub fn updateFrame(
|
|||||||
const v: Int = @bitCast(state.terminal.flags.dirty);
|
const v: Int = @bitCast(state.terminal.flags.dirty);
|
||||||
if (v > 0) self.cells_rebuild = true;
|
if (v > 0) self.cells_rebuild = true;
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
const Int = @typeInfo(terminal.Screen.Dirty).Struct.backing_integer.?;
|
||||||
|
const v: Int = @bitCast(state.terminal.screen.dirty);
|
||||||
|
if (v > 0) self.cells_rebuild = true;
|
||||||
|
}
|
||||||
|
|
||||||
// Reset the dirty flags in the terminal and screen. We assume
|
// Reset the dirty flags in the terminal and screen. We assume
|
||||||
// that our rebuild will be successful since so we optimize for
|
// that our rebuild will be successful since so we optimize for
|
||||||
|
@ -62,6 +62,16 @@ kitty_keyboard: kitty.KeyFlagStack = .{},
|
|||||||
/// Kitty graphics protocol state.
|
/// Kitty graphics protocol state.
|
||||||
kitty_images: kitty.graphics.ImageStorage = .{},
|
kitty_images: kitty.graphics.ImageStorage = .{},
|
||||||
|
|
||||||
|
/// Dirty flags for the renderer.
|
||||||
|
dirty: Dirty = .{},
|
||||||
|
|
||||||
|
/// See Terminal.Dirty. This behaves the same way.
|
||||||
|
pub const Dirty = packed struct {
|
||||||
|
/// Set when the selection is set or unset, regardless of if the
|
||||||
|
/// selection is changed or not.
|
||||||
|
selection: bool = false,
|
||||||
|
};
|
||||||
|
|
||||||
/// The cursor position.
|
/// The cursor position.
|
||||||
pub const Cursor = struct {
|
pub const Cursor = struct {
|
||||||
// The x/y position within the viewport.
|
// The x/y position within the viewport.
|
||||||
@ -362,6 +372,7 @@ pub fn clonePool(
|
|||||||
.no_scrollback = self.no_scrollback,
|
.no_scrollback = self.no_scrollback,
|
||||||
.cursor = cursor,
|
.cursor = cursor,
|
||||||
.selection = sel,
|
.selection = sel,
|
||||||
|
.dirty = self.dirty,
|
||||||
};
|
};
|
||||||
result.assertIntegrity();
|
result.assertIntegrity();
|
||||||
return result;
|
return result;
|
||||||
@ -1328,12 +1339,14 @@ pub fn select(self: *Screen, sel_: ?Selection) !void {
|
|||||||
// Untrack prior selection
|
// Untrack prior selection
|
||||||
if (self.selection) |*old| old.deinit(self);
|
if (self.selection) |*old| old.deinit(self);
|
||||||
self.selection = tracked_sel;
|
self.selection = tracked_sel;
|
||||||
|
self.dirty.selection = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 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.selection = null;
|
self.selection = null;
|
||||||
|
self.dirty.selection = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const SelectionString = struct {
|
pub const SelectionString = struct {
|
||||||
|
Reference in New Issue
Block a user