diff options
| author | Henil <71698300+henil@users.noreply.github.com> | 2020-11-16 22:15:15 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-11-16 17:45:15 +0100 |
| commit | 0ddcc4087e9dc249fc3e31b95026c3d325727b14 (patch) | |
| tree | e1844d6ecca6d1e43b3485364cf1565e8555355b /src/screen.rs | |
| parent | feat(ux): initial layout engine (#50) (diff) | |
| download | sl0ppij-0ddcc4087e9dc249fc3e31b95026c3d325727b14.tar.gz sl0ppij-0ddcc4087e9dc249fc3e31b95026c3d325727b14.tar.xz sl0ppij-0ddcc4087e9dc249fc3e31b95026c3d325727b14.zip | |
fix(ux): add variable to track if the pane is in fullscreen mode or not (#47)
* Fix the bug and add new tests
* add snapshots for integration tests
Diffstat (limited to 'src/screen.rs')
| -rw-r--r-- | src/screen.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/screen.rs b/src/screen.rs index 777b7935..52d618b3 100644 --- a/src/screen.rs +++ b/src/screen.rs @@ -94,6 +94,7 @@ pub struct Screen { panes_to_hide: HashSet<RawFd>, active_terminal: Option<RawFd>, os_api: Box<dyn OsApi>, + fullscreen_is_active: bool, } impl Screen { @@ -115,8 +116,10 @@ impl Screen { panes_to_hide: HashSet::new(), active_terminal: None, os_api, + fullscreen_is_active: false, } } + pub fn apply_layout(&mut self, layout: Layout, new_pids: Vec<RawFd>) { self.panes_to_hide.clear(); // TODO: this should be an attribute on Screen instead of full_screen_ws @@ -175,8 +178,16 @@ impl Screen { self.active_terminal = Some(*self.terminals.iter().next().unwrap().0); self.render(); } + + pub fn toggle_fullscreen_is_active(&mut self) { + self.fullscreen_is_active = !self.fullscreen_is_active; + } + pub fn new_pane(&mut self, pid: RawFd) { self.close_down_to_max_terminals(); + if self.fullscreen_is_active { + self.toggle_active_terminal_fullscreen(); + } if self.terminals.is_empty() { let x = 0; let y = 0; @@ -263,6 +274,9 @@ impl Screen { } pub fn horizontal_split(&mut self, pid: RawFd) { self.close_down_to_max_terminals(); + if self.fullscreen_is_active { + self.toggle_active_terminal_fullscreen(); + } if self.terminals.is_empty() { let x = 0; let y = 0; @@ -318,6 +332,9 @@ impl Screen { } pub fn vertical_split(&mut self, pid: RawFd) { self.close_down_to_max_terminals(); + if self.fullscreen_is_active { + self.toggle_active_terminal_fullscreen(); + } if self.terminals.is_empty() { let x = 0; let y = 0; @@ -449,6 +466,7 @@ impl Screen { active_terminal.get_rows() as u16, ); self.render(); + self.toggle_fullscreen_is_active(); } } pub fn render(&mut self) { |
