1
1
use zellij_tile:: prelude:: * ;
2
2
3
+ pub struct FrameConfig {
4
+ pub hide_frames_for_single_pane : bool ,
5
+ pub hide_frames_except_for_search : bool ,
6
+ pub hide_frames_except_for_fullscreen : bool ,
7
+ }
8
+
9
+ impl FrameConfig {
10
+ pub fn new (
11
+ hide_frames_for_single_pane : bool ,
12
+ hide_frames_except_for_search : bool ,
13
+ hide_frames_except_for_fullscreen : bool ,
14
+ ) -> Self {
15
+ Self {
16
+ hide_frames_for_single_pane,
17
+ hide_frames_except_for_search,
18
+ hide_frames_except_for_fullscreen,
19
+ }
20
+ }
21
+
22
+ pub fn is_disabled ( & self ) -> bool {
23
+ !self . hide_frames_for_single_pane
24
+ && !self . hide_frames_except_for_search
25
+ && !self . hide_frames_except_for_fullscreen
26
+ }
27
+ }
28
+
3
29
#[ tracing:: instrument( skip_all) ]
4
30
pub fn hide_frames_conditionally (
5
- cfg_hide_frames_for_single_pane : bool ,
6
- cfg_hide_frames_except_for_search : bool ,
7
- cfg_hide_frames_except_for_fullscreen : bool ,
31
+ config : & FrameConfig ,
8
32
tabs : & [ TabInfo ] ,
9
33
pane_info : & PaneManifest ,
10
34
mode_info : & ModeInfo ,
11
35
plugin_pane_id : PluginIds ,
12
36
is_zjframes : bool ,
13
37
) {
14
- if !cfg_hide_frames_for_single_pane
15
- && !cfg_hide_frames_except_for_search
16
- && !cfg_hide_frames_except_for_fullscreen
17
- {
38
+ if config. is_disabled ( ) {
18
39
return ;
19
40
}
20
41
@@ -41,11 +62,11 @@ pub fn hide_frames_conditionally(
41
62
let frame_enabled = panes. iter ( ) . any ( |p| p. pane_content_x - p. pane_x > 0 ) ;
42
63
43
64
let frames_for_search =
44
- cfg_hide_frames_except_for_search && should_show_frames_for_search ( mode_info) ;
65
+ config . hide_frames_except_for_search && should_show_frames_for_search ( mode_info) ;
45
66
let frames_for_fullscreen =
46
- cfg_hide_frames_except_for_fullscreen && should_show_frames_for_fullscreen ( & panes) ;
67
+ config . hide_frames_except_for_fullscreen && should_show_frames_for_fullscreen ( & panes) ;
47
68
let frames_for_single_pane =
48
- cfg_hide_frames_for_single_pane && should_show_frames_for_multiple_panes ( mode_info, & panes) ;
69
+ config . hide_frames_for_single_pane && should_show_frames_for_multiple_panes ( mode_info, & panes) ;
49
70
50
71
if ( frames_for_search || frames_for_fullscreen || frames_for_single_pane) && !frame_enabled {
51
72
toggle_pane_frames ( ) ;
0 commit comments