aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDante Pippi <6619666+dantepippi@users.noreply.github.com>2021-05-09 17:24:15 -0300
committerDante Pippi <6619666+dantepippi@users.noreply.github.com>2021-05-09 17:24:15 -0300
commit62796c1a31a8babd2edf16054852f00bab0557df (patch)
treee40fb0589f4f7b485e34ed52b574c99d92445158 /src
parentNew behavior for h and l (diff)
downloadsl0ppij-62796c1a31a8babd2edf16054852f00bab0557df.tar.gz
sl0ppij-62796c1a31a8babd2edf16054852f00bab0557df.tar.xz
sl0ppij-62796c1a31a8babd2edf16054852f00bab0557df.zip
After rebase
Diffstat (limited to 'src')
-rw-r--r--src/client/tab.rs4
-rw-r--r--src/common/screen.rs20
-rw-r--r--src/server/route.rs8
3 files changed, 30 insertions, 2 deletions
diff --git a/src/client/tab.rs b/src/client/tab.rs
index 7636be39..f0ec0869 100644
--- a/src/client/tab.rs
+++ b/src/client/tab.rs
@@ -1848,7 +1848,7 @@ impl Tab {
}
self.render();
}
- // returns a boolean to allow the caller to know if the move happened or not
+ // returns a boolean that indicates whether the focus moved
pub fn move_focus_left(&mut self) -> bool {
if !self.has_selectable_panes() {
return false;
@@ -1941,7 +1941,7 @@ impl Tab {
}
self.render();
}
- // returns a boolean to allow the caller to know if the move happened or not
+ // returns a boolean that indicates whether the focus moved
pub fn move_focus_right(&mut self) -> bool {
if !self.has_selectable_panes() {
return false;
diff --git a/src/common/screen.rs b/src/common/screen.rs
index 525575bf..44cfe3ba 100644
--- a/src/common/screen.rs
+++ b/src/common/screen.rs
@@ -424,12 +424,32 @@ pub fn screen_thread_main(
ScreenInstruction::MoveFocusLeft => {
screen.get_active_tab_mut().unwrap().move_focus_left();
}
+ ScreenInstruction::MoveFocusLeftOrPreviousTab => {
+ if !screen.get_active_tab_mut().unwrap().move_focus_left() {
+ screen.switch_tab_prev();
+ }
+ screen
+ .bus
+ .senders
+ .send_to_server(ServerInstruction::UnblockInputThread)
+ .unwrap();
+ }
ScreenInstruction::MoveFocusDown => {
screen.get_active_tab_mut().unwrap().move_focus_down();
}
ScreenInstruction::MoveFocusRight => {
screen.get_active_tab_mut().unwrap().move_focus_right();
}
+ ScreenInstruction::MoveFocusRightOrNextTab => {
+ if !screen.get_active_tab_mut().unwrap().move_focus_right() {
+ screen.switch_tab_next();
+ }
+ screen
+ .bus
+ .senders
+ .send_to_server(ServerInstruction::UnblockInputThread)
+ .unwrap();
+ }
ScreenInstruction::MoveFocusUp => {
screen.get_active_tab_mut().unwrap().move_focus_up();
}
diff --git a/src/server/route.rs b/src/server/route.rs
index 1fa5825a..668cdfbd 100644
--- a/src/server/route.rs
+++ b/src/server/route.rs
@@ -78,6 +78,14 @@ fn route_action(action: Action, session: &SessionMetaData, os_input: &dyn Server
};
session.senders.send_to_screen(screen_instr).unwrap();
}
+ Action::MoveFocusOrTab(direction) => {
+ let screen_instr = match direction {
+ Direction::Left => ScreenInstruction::MoveFocusLeftOrPreviousTab,
+ Direction::Right => ScreenInstruction::MoveFocusRightOrNextTab,
+ _ => unreachable!(),
+ };
+ session.senders.send_to_screen(screen_instr).unwrap();
+ }
Action::ScrollUp => {
session
.senders