mirror of
https://github.com/zellij-org/zellij.git
synced 2024-11-27 14:34:32 +03:00
fix(ui): left click on tabs when pane is on fullscreen mode (#977)
* Fix left click on tabs when pane is on fullscreen mode * run fmt
This commit is contained in:
parent
855413c8c4
commit
8f5325e4ed
@ -1,6 +1,7 @@
|
|||||||
//! `Tab`s holds multiple panes. It tracks their coordinates (x/y) and size,
|
//! `Tab`s holds multiple panes. It tracks their coordinates (x/y) and size,
|
||||||
//! as well as how they should be resized
|
//! as well as how they should be resized
|
||||||
|
|
||||||
|
use zellij_utils::position::{Column, Line};
|
||||||
use zellij_utils::{position::Position, serde, zellij_tile};
|
use zellij_utils::{position::Position, serde, zellij_tile};
|
||||||
|
|
||||||
use crate::ui::pane_boundaries_frame::FrameParams;
|
use crate::ui::pane_boundaries_frame::FrameParams;
|
||||||
@ -3350,7 +3351,7 @@ impl Tab {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn get_pane_id_at(&self, point: &Position, search_selectable: bool) -> Option<PaneId> {
|
fn get_pane_id_at(&self, point: &Position, search_selectable: bool) -> Option<PaneId> {
|
||||||
if self.fullscreen_is_active {
|
if self.fullscreen_is_active && self.is_position_inside_viewport(point) {
|
||||||
let first_client_id = self.connected_clients.iter().next().unwrap(); // TODO: instead of doing this, record the pane that is in fullscreen
|
let first_client_id = self.connected_clients.iter().next().unwrap(); // TODO: instead of doing this, record the pane that is in fullscreen
|
||||||
return self.get_active_pane_id(*first_client_id);
|
return self.get_active_pane_id(*first_client_id);
|
||||||
}
|
}
|
||||||
@ -3526,6 +3527,19 @@ impl Tab {
|
|||||||
active_terminal.update_name(s);
|
active_terminal.update_name(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn is_position_inside_viewport(&self, point: &Position) -> bool {
|
||||||
|
let Position {
|
||||||
|
line: Line(line),
|
||||||
|
column: Column(column),
|
||||||
|
} = *point;
|
||||||
|
let line: usize = line.try_into().unwrap();
|
||||||
|
|
||||||
|
line >= self.viewport.y
|
||||||
|
&& column >= self.viewport.x
|
||||||
|
&& line <= self.viewport.y + self.viewport.rows
|
||||||
|
&& column <= self.viewport.x + self.viewport.cols
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::borrowed_box)]
|
#[allow(clippy::borrowed_box)]
|
||||||
|
Loading…
Reference in New Issue
Block a user