From b6497f5d1d7c03e121b1b68db256f551fc4ed14f Mon Sep 17 00:00:00 2001 From: toonn Date: Wed, 22 Aug 2018 18:36:40 +0200 Subject: 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. --- ranger/core/actions.py | 16 +++++----------- 1 file 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 -- cgit 1.4.1-2-gfad0