mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-15 16:26:08 +03:00
terminal: do not set selection manually
This commit is contained in:
@ -868,8 +868,7 @@ pub fn manualStyleUpdate(self: *Screen) !void {
|
|||||||
/// is always tracked.
|
/// is always tracked.
|
||||||
pub fn select(self: *Screen, sel_: ?Selection) !void {
|
pub fn select(self: *Screen, sel_: ?Selection) !void {
|
||||||
const sel = sel_ orelse {
|
const sel = sel_ orelse {
|
||||||
if (self.selection) |*old| old.deinit(self);
|
self.clearSelection();
|
||||||
self.selection = null;
|
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -882,6 +881,12 @@ pub fn select(self: *Screen, sel_: ?Selection) !void {
|
|||||||
self.selection = tracked_sel;
|
self.selection = tracked_sel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Same as select(null) but can't fail.
|
||||||
|
pub fn clearSelection(self: *Screen) void {
|
||||||
|
if (self.selection) |*sel| sel.deinit(self);
|
||||||
|
self.selection = null;
|
||||||
|
}
|
||||||
|
|
||||||
/// Returns the raw text associated with a selection. This will unwrap
|
/// Returns the raw text associated with a selection. This will unwrap
|
||||||
/// soft-wrapped edges. The returned slice is owned by the caller and allocated
|
/// soft-wrapped edges. The returned slice is owned by the caller and allocated
|
||||||
/// using alloc, not the allocator associated with the screen (unless they match).
|
/// using alloc, not the allocator associated with the screen (unless they match).
|
||||||
|
@ -2139,7 +2139,7 @@ pub fn alternateScreen(
|
|||||||
self.screen.charset = old.charset;
|
self.screen.charset = old.charset;
|
||||||
|
|
||||||
// Clear our selection
|
// Clear our selection
|
||||||
self.screen.selection = null;
|
self.screen.clearSelection();
|
||||||
|
|
||||||
// Mark kitty images as dirty so they redraw
|
// Mark kitty images as dirty so they redraw
|
||||||
self.screen.kitty_images.dirty = true;
|
self.screen.kitty_images.dirty = true;
|
||||||
@ -2174,7 +2174,7 @@ pub fn primaryScreen(
|
|||||||
self.active_screen = .primary;
|
self.active_screen = .primary;
|
||||||
|
|
||||||
// Clear our selection
|
// Clear our selection
|
||||||
self.screen.selection = null;
|
self.screen.clearSelection();
|
||||||
|
|
||||||
// Mark kitty images as dirty so they redraw
|
// Mark kitty images as dirty so they redraw
|
||||||
self.screen.kitty_images.dirty = true;
|
self.screen.kitty_images.dirty = true;
|
||||||
@ -2203,7 +2203,7 @@ pub fn fullReset(self: *Terminal) void {
|
|||||||
self.flags = .{};
|
self.flags = .{};
|
||||||
self.tabstops.reset(TABSTOP_INTERVAL);
|
self.tabstops.reset(TABSTOP_INTERVAL);
|
||||||
self.screen.saved_cursor = null;
|
self.screen.saved_cursor = null;
|
||||||
self.screen.selection = null;
|
self.screen.clearSelection();
|
||||||
self.screen.kitty_keyboard = .{};
|
self.screen.kitty_keyboard = .{};
|
||||||
self.screen.protected_mode = .off;
|
self.screen.protected_mode = .off;
|
||||||
self.scrolling_region = .{
|
self.scrolling_region = .{
|
||||||
|
Reference in New Issue
Block a user