diff options
| author | Daniel Jankowski <daniel.jankowski@rub.de> | 2025-01-18 10:00:01 +0100 |
|---|---|---|
| committer | Daniel Jankowski <daniel.jankowski@rub.de> | 2025-01-18 10:00:01 +0100 |
| commit | 94e60999fd968505803ea6d3390caf98497a0eee (patch) | |
| tree | 7b933cdbf5ece24aa20384e001d64680bf1907ae /src/frames.rs | |
| parent | fix(frames): show frames in search mode (diff) | |
| download | sl0pstatus-94e60999fd968505803ea6d3390caf98497a0eee.tar.gz sl0pstatus-94e60999fd968505803ea6d3390caf98497a0eee.tar.xz sl0pstatus-94e60999fd968505803ea6d3390caf98497a0eee.zip | |
feat(frames): hide frame except for scroll
fixes #116
Diffstat (limited to '')
| -rw-r--r-- | src/frames.rs | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/frames.rs b/src/frames.rs index 268636e..60f4128 100644 --- a/src/frames.rs +++ b/src/frames.rs @@ -4,6 +4,7 @@ pub struct FrameConfig { pub hide_frames_for_single_pane: bool, pub hide_frames_except_for_search: bool, pub hide_frames_except_for_fullscreen: bool, + pub hide_frames_except_for_scroll: bool, } impl FrameConfig { @@ -11,11 +12,13 @@ impl FrameConfig { hide_frames_for_single_pane: bool, hide_frames_except_for_search: bool, hide_frames_except_for_fullscreen: bool, + hide_frames_except_for_scroll: bool, ) -> Self { Self { hide_frames_for_single_pane, hide_frames_except_for_search, hide_frames_except_for_fullscreen, + hide_frames_except_for_scroll, } } @@ -23,6 +26,7 @@ impl FrameConfig { !self.hide_frames_for_single_pane && !self.hide_frames_except_for_search && !self.hide_frames_except_for_fullscreen + && !self.hide_frames_except_for_scroll } } @@ -67,16 +71,29 @@ pub fn hide_frames_conditionally( config.hide_frames_except_for_fullscreen && should_show_frames_for_fullscreen(&panes); let frames_for_single_pane = config.hide_frames_for_single_pane && should_show_frames_for_multiple_panes(mode_info, &panes); + let frames_for_scroll = + config.hide_frames_except_for_scroll && should_show_frames_for_scroll(mode_info); - if (frames_for_search || frames_for_fullscreen || frames_for_single_pane) && !frame_enabled { + if (frames_for_search || frames_for_fullscreen || frames_for_single_pane || frames_for_scroll) + && !frame_enabled + { toggle_pane_frames(); } - if (!frames_for_search && !frames_for_fullscreen && !frames_for_single_pane) && frame_enabled { + if (!frames_for_search + && !frames_for_fullscreen + && !frames_for_single_pane + && !frames_for_scroll) + && frame_enabled + { toggle_pane_frames(); } } +pub fn should_show_frames_for_scroll(mode_info: &ModeInfo) -> bool { + mode_info.mode == InputMode::Scroll +} + pub fn should_show_frames_for_search(mode_info: &ModeInfo) -> bool { mode_info.mode == InputMode::EnterSearch || mode_info.mode == InputMode::Search } |
