diff options
-rw-r--r-- | ranger/core/actions.py | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/ranger/core/actions.py b/ranger/core/actions.py index b5a763f8..1d95a9b7 100644 --- a/ranger/core/actions.py +++ b/ranger/core/actions.py @@ -1244,28 +1244,22 @@ class Actions( # pylint: disable=too-many-instance-attributes,too-many-public-m self.signal_emit('tab.layoutchange') return None - def tab_shift(self, offset=0, pos=None): + def tab_shift(self, offset=0, to=None): # pylint: disable=invalid-name """Shift the tab left/right Shift the current tab to the left or right by either: offset - changes the tab number by offset - pos - shifts the tab to the specified tab number + to - shifts the tab to the specified tab number """ oldtab_index = self.current_tab - if pos is None: + if to is None: assert isinstance(offset, int) # enumerated index (1 to 9) newtab_index = oldtab_index + offset - if newtab_index < 1: - newtab_index = 1 - if newtab_index > 9: - newtab_index = 9 else: - assert isinstance(pos, int) - if pos < 1 or pos > 9: - return None - newtab_index = pos + assert isinstance(to, int) + newtab_index = to # shift tabs without enumerating, preserve tab numbers when can if newtab_index != oldtab_index: # the other tabs shift in the opposite direction |