diff options
| author | Daniel Jankowski <daniel.jankowski@rub.de> | 2023-12-26 19:37:03 +0100 |
|---|---|---|
| committer | Daniel Jankowski <daniel.jankowski@rub.de> | 2023-12-26 19:37:03 +0100 |
| commit | 97a62bef5158650593e002374824f31ccf4521b8 (patch) | |
| tree | 365c570f2533f4b3f2fc138650cdc84aa08a7daa /src/frames.rs | |
| parent | feat: render only widgets that needs an update (diff) | |
| download | sl0pstatus-97a62bef5158650593e002374824f31ccf4521b8.tar.gz sl0pstatus-97a62bef5158650593e002374824f31ccf4521b8.tar.xz sl0pstatus-97a62bef5158650593e002374824f31ccf4521b8.zip | |
fix: hide_frame_for_single_pane if first pane is borderless
Diffstat (limited to 'src/frames.rs')
| -rw-r--r-- | src/frames.rs | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/src/frames.rs b/src/frames.rs index d43a0e4..7284295 100644 --- a/src/frames.rs +++ b/src/frames.rs @@ -19,14 +19,9 @@ pub fn hide_frames_on_single_pane( let panes: Vec<&PaneInfo> = panes.iter().filter(|p| !p.is_plugin).collect(); - let first_pane = match panes.first() { - Some(fp) => fp, - None => return, - }; - // frame is enabled, when content does no start at [0, 0]. With default frames // it's [1, 1] - let frame_enabled = first_pane.pane_content_x > 0; + let frame_enabled = panes.iter().any(|p| p.pane_content_x - p.pane_x > 0); if panes.len() == 1 && frame_enabled { toggle_pane_frames(); @@ -38,19 +33,14 @@ pub fn hide_frames_on_single_pane( } fn is_plugin_for_current_tab(panes: &[PaneInfo], plugin_pane_id: PluginIds) -> bool { - let plugin_pane = panes + panes .iter() - .find(|p| p.is_plugin && p.id == plugin_pane_id.plugin_id); - - plugin_pane.is_some() + .any(|p| p.is_plugin && p.id == plugin_pane_id.plugin_id) } fn get_current_panes(tabs: &[TabInfo], pane_info: &PaneManifest) -> Option<Vec<PaneInfo>> { let active_tab = tabs.iter().find(|t| t.active); let active_tab = active_tab.as_ref()?; - pane_info - .panes - .get(&active_tab.position) - .cloned() + pane_info.panes.get(&active_tab.position).cloned() } |
