After rebase

This commit is contained in:
Dante Pippi 2021-05-09 17:24:15 -03:00
parent 9c09cf1658
commit 62796c1a31
3 changed files with 30 additions and 2 deletions

View file

@ -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;

View file

@ -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();
}

View file

@ -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