diff options
| author | Dante Pippi <6619666+dantepippi@users.noreply.github.com> | 2021-05-07 18:19:23 -0300 |
|---|---|---|
| committer | Dante Pippi <6619666+dantepippi@users.noreply.github.com> | 2021-05-09 17:05:14 -0300 |
| commit | 9c09cf16587a2b97c63c05d94ff4f18fe557cbf5 (patch) | |
| tree | 18a8ff8eebbbff0f93eb5af8e270c398ccb65a70 /src/common | |
| parent | Merge pull request #473 from zellij-org/bus-business-with-extra-merge-fun (diff) | |
| download | sl0ppij-9c09cf16587a2b97c63c05d94ff4f18fe557cbf5.tar.gz sl0ppij-9c09cf16587a2b97c63c05d94ff4f18fe557cbf5.tar.xz sl0ppij-9c09cf16587a2b97c63c05d94ff4f18fe557cbf5.zip | |
New behavior for h and l
New behavior for h and l, will change tabs if there are no available
panes in the direction.
cargo clippy
Ensuring atomicity for the MoveFocusOrTab
- Blocking the input thread for the action MoveFocusOrTab
- Using "unreachable" macro in match arm to make it clear that the
directions Up and Down should not be used with the action MoveFocusOrTab
Adding tests
Diffstat (limited to 'src/common')
| -rw-r--r-- | src/common/errors.rs | 6 | ||||
| -rw-r--r-- | src/common/input/actions.rs | 3 | ||||
| -rw-r--r-- | src/common/input/handler.rs | 3 | ||||
| -rw-r--r-- | src/common/screen.rs | 2 |
4 files changed, 13 insertions, 1 deletions
diff --git a/src/common/errors.rs b/src/common/errors.rs index 148a3a9e..c2caf19d 100644 --- a/src/common/errors.rs +++ b/src/common/errors.rs @@ -192,9 +192,11 @@ pub enum ScreenContext { FocusNextPane, FocusPreviousPane, MoveFocusLeft, + MoveFocusLeftOrPreviousTab, MoveFocusDown, MoveFocusUp, MoveFocusRight, + MoveFocusRightOrNextTab, Exit, ScrollUp, ScrollDown, @@ -237,9 +239,13 @@ impl From<&ScreenInstruction> for ScreenContext { ScreenInstruction::FocusNextPane => ScreenContext::FocusNextPane, ScreenInstruction::FocusPreviousPane => ScreenContext::FocusPreviousPane, ScreenInstruction::MoveFocusLeft => ScreenContext::MoveFocusLeft, + ScreenInstruction::MoveFocusLeftOrPreviousTab => { + ScreenContext::MoveFocusLeftOrPreviousTab + } ScreenInstruction::MoveFocusDown => ScreenContext::MoveFocusDown, ScreenInstruction::MoveFocusUp => ScreenContext::MoveFocusUp, ScreenInstruction::MoveFocusRight => ScreenContext::MoveFocusRight, + ScreenInstruction::MoveFocusRightOrNextTab => ScreenContext::MoveFocusRightOrNextTab, ScreenInstruction::Exit => ScreenContext::Exit, ScreenInstruction::ScrollUp => ScreenContext::ScrollUp, ScreenInstruction::ScrollDown => ScreenContext::ScrollDown, diff --git a/src/common/input/actions.rs b/src/common/input/actions.rs index 54cbbcdc..b806aa3f 100644 --- a/src/common/input/actions.rs +++ b/src/common/input/actions.rs @@ -29,6 +29,9 @@ pub enum Action { /// Move the focus pane in specified direction. SwitchFocus, MoveFocus(Direction), + /// Tries to move the focus pane in specified direction. + /// If there is no pane in the direction, move to previous/next Tab. + MoveFocusOrTab(Direction), /// Scroll up in focus pane. ScrollUp, /// Scroll down in focus pane. diff --git a/src/common/input/handler.rs b/src/common/input/handler.rs index 78635237..aa204850 100644 --- a/src/common/input/handler.rs +++ b/src/common/input/handler.rs @@ -119,7 +119,8 @@ impl InputHandler { | Action::GoToNextTab | Action::GoToPreviousTab | Action::CloseTab - | Action::GoToTab(_) => { + | Action::GoToTab(_) + | Action::MoveFocusOrTab(_) => { self.command_is_executing.blocking_input_thread(); self.os_input .send_to_server(ServerInstruction::Action(action)); diff --git a/src/common/screen.rs b/src/common/screen.rs index b12578a7..525575bf 100644 --- a/src/common/screen.rs +++ b/src/common/screen.rs @@ -33,9 +33,11 @@ pub enum ScreenInstruction { FocusNextPane, FocusPreviousPane, MoveFocusLeft, + MoveFocusLeftOrPreviousTab, MoveFocusDown, MoveFocusUp, MoveFocusRight, + MoveFocusRightOrNextTab, Exit, ScrollUp, ScrollDown, |
