core: mouse untracks pin in right screen

This commit is contained in:
Mitchell Hashimoto
2024-03-13 09:32:46 -07:00
parent 3e247baef7
commit d805fdd672
2 changed files with 11 additions and 2 deletions

View File

@ -2298,9 +2298,10 @@ pub fn mouseButtonCallback(
if (distance > max_distance) self.mouse.left_click_count = 0; if (distance > max_distance) self.mouse.left_click_count = 0;
} }
// TODO(paged-terminal): untrack previous pin across screens
if (self.mouse.left_click_pin) |prev| { if (self.mouse.left_click_pin) |prev| {
screen.pages.untrackPin(prev); const pin_screen = t.getScreen(self.mouse.left_click_screen);
pin_screen.pages.untrackPin(prev);
self.mouse.left_click_pin = null;
} }
// Store it // Store it

View File

@ -2105,6 +2105,14 @@ pub fn getPwd(self: *const Terminal) ?[]const u8 {
return self.pwd.items; return self.pwd.items;
} }
/// Get the screen pointer for the given type.
pub fn getScreen(self: *Terminal, t: ScreenType) *Screen {
return if (self.active_screen == t)
&self.screen
else
&self.secondary_screen;
}
/// Options for switching to the alternate screen. /// Options for switching to the alternate screen.
pub const AlternateScreenOptions = struct { pub const AlternateScreenOptions = struct {
cursor_save: bool = false, cursor_save: bool = false,