mod floating_pane_grid;
use zellij_utils::position::Position;
use crate::tab::Pane;
use floating_pane_grid::FloatingPaneGrid;
use crate::{
os_input_output::ServerOsApi,
output::{FloatingPanesStack, Output},
panes::PaneId,
ui::pane_contents_and_ui::PaneContentsAndUi,
ClientId,
};
use std::cell::RefCell;
use std::collections::{BTreeMap, HashMap, HashSet};
use std::rc::Rc;
use std::time::Instant;
use zellij_utils::{
data::{ModeInfo, Style},
errors::prelude::*,
input::command::RunCommand,
pane_size::{Offset, PaneGeom, Size, Viewport},
};
macro_rules! resize_pty {
($pane:expr, $os_input:expr) => {
if let PaneId::Terminal(ref pid) = $pane.pid() {
// FIXME: This `set_terminal_size_using_terminal_id` call would be best in
// `TerminalPane::reflow_lines`
$os_input.set_terminal_size_using_terminal_id(
*pid,
$pane.get_content_columns() as u16,
$pane.get_content_rows() as u16,
);
}
};
}
pub struct FloatingPanes {
panes: BTreeMap<PaneId, Box<dyn Pane>>,
display_area: Rc<RefCell<Size>>,
viewport: Rc<RefCell<Viewport>>,
connected_clients: Rc<RefCell<HashSet<ClientId>>>,
connected_clients_in_app: Rc<RefCell<HashSet<ClientId>>>,
mode_info: Rc<RefCell<HashMap<ClientId, ModeInfo>>>,
default_mode_info: ModeInfo,
style: Style,
session_is_mirrored: bool,
desired_pane_positions: HashMap<PaneId, PaneGeom>, // this represents the positions of panes the user moved with intention, rather than by resizing the terminal window
z_indices: Vec<PaneId>,
active_panes: HashMap<ClientId, PaneId>,
show_panes: bool,
pane_being_moved_with_mouse: Option<(PaneId, Position)>