Repository: zellij-org/zellij
File: zellij-server/src/tab.rs (Rust)

Code before:
        senders: ThreadSenders,
        max_panes: Option<usize>,
        pane_id: Option<PaneId>,
        mode_info: ModeInfo,
        input_mode: InputMode,
        colors: Palette,
        session_state: Arc<RwLock<SessionState>>,
    ) -> Self {
        let panes = if let Some(PaneId::Terminal(pid)) = pane_id {
            let new_terminal = TerminalPane::new(pid, *full_screen_ws, colors);
            os_api.set_terminal_size_using_fd(
                new_terminal.pid,
                new_terminal.columns() as u16,
                new_terminal.rows() as u16,
            );
            let mut panes: BTreeMap<PaneId, Box<dyn Pane>> = BTreeMap::new();
            panes.insert(PaneId::Terminal(pid), Box::new(new_terminal));
            panes
        } else {
            BTreeMap::new()
        };
        Tab {
            index,
            position,
            panes,
            name: if name.is_empty() {
                format!("Tab #{} (unnamed)", position + 1)
            } else {
                name
            },
            max_panes,
            panes_to_hide: HashSet::new(),
            active_terminal: pane_id,
            full_screen_ws: *full_screen_ws,
            fullscreen_is_active: false,
            synchronize_is_active: false,
            os_api,
            senders,
            should_clear_display_before_rendering: false,
            mode_info,
            input_mode,
            colors,
            session_state,
        }
    }

    pub fn apply_layout(&mut self, layout: Layout, new_pids: Vec<RawFd>) {
        // TODO: this should be an attribute on Screen instead of full_screen_ws
        let free_space = PositionAndSize {
            x: 0,
            y: 0,

Review comment (suggestion):
I would prefer the initialization here just like the `panes` are initialized.

`let name =` prior and then keep the name here.

Code after:
        senders: ThreadSenders,
        max_panes: Option<usize>,
        pane_id: Option<PaneId>,
        mode_info: ModeInfo,
        input_mode: InputMode,
        colors: Palette,
        session_state: Arc<RwLock<SessionState>>,
    ) -> Self {
        let panes = if let Some(PaneId::Terminal(pid)) = pane_id {
            let new_terminal = TerminalPane::new(pid, *full_screen_ws, colors);
            os_api.set_terminal_size_using_fd(
                new_terminal.pid,
                new_terminal.columns() as u16,
                new_terminal.rows() as u16,
            );
            let mut panes: BTreeMap<PaneId, Box<dyn Pane>> = BTreeMap::new();
            panes.insert(PaneId::Terminal(pid), Box::new(new_terminal));
            panes
        } else {
            BTreeMap::new()
        };

        let name = if name.is_empty() {
            format!("Tab #{}", position + 1)
        } else {
            name
        };

        Tab {
            index,
            position,
            panes,
            name,
            max_panes,
            panes_to_hide: HashSet::new(),
            active_terminal: pane_id,
            full_screen_ws: *full_screen_ws,
            fullscreen_is_active: false,
            synchronize_is_active: false,
            os_api,
            senders,
            should_clear_display_before_rendering: false,
            mode_info,
            input_mode,
            colors,
            session_state,
        }
    }

    pub fn apply_layout(&mut self, layout: Layout, new_pids: Vec<RawFd>) {
        // TODO: this should be an attribute on Screen instead of full_screen_ws