1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-18 10:52:16 +03:00

allow cycling from tab 0 -> max when using hotkeys

We would allow wrapping around the top end of tabs, but not the bottom.
This fixes that.
This commit is contained in:
Wez Furlong 2018-08-04 22:36:43 -07:00
parent 899593745e
commit fd148f33e9

View File

@ -593,7 +593,9 @@ impl TerminalWindow {
pub fn activate_tab_relative(&mut self, delta: isize) -> Result<(), Error> {
let max = self.tabs.tabs.len();
let tab = (self.tabs.active as isize + delta) as usize % max;
self.activate_tab(tab)
let active = self.tabs.active as isize;
let tab = active + delta;
let tab = if tab < 0 { max as isize + tab } else { tab };
self.activate_tab(tab as usize % max)
}
}