diff options
author | toonn <toonn@toonn.io> | 2018-08-22 18:36:40 +0200 |
---|---|---|
committer | toonn <toonn@toonn.io> | 2018-08-22 19:42:46 +0200 |
commit | b6497f5d1d7c03e121b1b68db256f551fc4ed14f (patch) | |
tree | 9ff511a87059f0779128abc49ae33d13a72983c2 | |
parent | c036ce360bc838f9a51f3f21d65e8add2a28b7fc (diff) | |
download | ranger-b6497f5d1d7c03e121b1b68db256f551fc4ed14f.tar.gz |
Remove limit and change pos to to
Let's have the users report how they want shifting to work. You can currently create tabs at negative indices so it feels wrong not to be able to shift tabs there or have shifts of tabs at negative indices have a weird result.
-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 |