Skip to content

Commit

Permalink
feat(frames): show frames when renaming pane or searching
Browse files Browse the repository at this point in the history
  • Loading branch information
dj95 committed May 25, 2024
1 parent 7fb1e83 commit c186c82
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/bin/zjstatus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ impl State {
frames::hide_frames_on_single_pane(
self.state.tabs.clone(),
&pane_info,
&self.state.mode,
get_plugin_ids(),
);
}
Expand Down Expand Up @@ -247,6 +248,7 @@ impl State {
frames::hide_frames_on_single_pane(
current_session.clone().tabs,
&current_session.panes,
&self.state.mode,
get_plugin_ids(),
);
}
Expand Down
18 changes: 17 additions & 1 deletion src/frames.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use zellij_tile::prelude::*;
pub fn hide_frames_on_single_pane(
tabs: Vec<TabInfo>,
pane_info: &PaneManifest,
mode_info: &ModeInfo,
plugin_pane_id: PluginIds,
) {
let panes = match get_current_panes(&tabs, pane_info) {
Expand All @@ -20,12 +21,27 @@ pub fn hide_frames_on_single_pane(

tracing::debug!("panes {:?}", panes);

let panes: Vec<&PaneInfo> = panes.iter().filter(|p| !p.is_plugin && !p.is_floating).collect();
let panes: Vec<&PaneInfo> = panes
.iter()
.filter(|p| !p.is_plugin && !p.is_floating)
.collect();

// frame is enabled, when content does no start at [0, 0]. With default frames
// it's [1, 1]
let frame_enabled = panes.iter().any(|p| p.pane_content_x - p.pane_x > 0);

tracing::debug!("mode: {:?}", mode_info.mode);
if mode_info.mode == InputMode::RenamePane
|| mode_info.mode == InputMode::Search
|| mode_info.mode == InputMode::EnterSearch
{
if !frame_enabled {
toggle_pane_frames();
}

return;
}

if panes.len() == 1 && frame_enabled {
toggle_pane_frames();
}
Expand Down

0 comments on commit c186c82

Please sign in to comment.