diff --git a/README.asciidoc b/README.asciidoc index 83f9f07f9..1c1aa4088 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -160,6 +160,7 @@ Contributors, sorted by the number of commits in descending order: * John ShaggyTwoDope Jenkins * Peter Vilim * Jonas Schürmann +* Panagiotis Ktistakis * Jimmy * skinnay * error800 @@ -167,7 +168,6 @@ Contributors, sorted by the number of commits in descending order: * Halfwit * Felix Van der Jeugt * rikn00 -* Panagiotis Ktistakis * Martin Zimmermann * Brian Jackson * sbinix diff --git a/qutebrowser/browser/commands.py b/qutebrowser/browser/commands.py index 6c48a0afe..f36f9172b 100644 --- a/qutebrowser/browser/commands.py +++ b/qutebrowser/browser/commands.py @@ -900,6 +900,9 @@ class CommandDispatcher: new_idx = self._current_index() - delta elif direction == '+': # pragma: no branch new_idx = self._current_index() + delta + + if config.get('tabs', 'wrap'): + new_idx %= self._count() else: # pragma: no cover raise ValueError("Invalid direction '{}'!".format(direction)) diff --git a/tests/integration/features/tabs.feature b/tests/integration/features/tabs.feature index 561caf996..97ea18704 100644 --- a/tests/integration/features/tabs.feature +++ b/tests/integration/features/tabs.feature @@ -384,13 +384,37 @@ Feature: Tab management - data/numbers/2.txt Scenario: :tab-move with relative position and too big count. - When I open data/numbers/1.txt + When I set tabs -> wrap to false + And I open data/numbers/1.txt And I open data/numbers/2.txt in a new tab And I open data/numbers/3.txt in a new tab And I run :tab-focus 1 And I run :tab-move + with count 3 Then the error "Can't move tab to position 4!" should be shown + Scenario: :tab-move with relative position (positive) and wrap + When I set tabs -> wrap to true + And I open data/numbers/1.txt + And I open data/numbers/2.txt in a new tab + And I open data/numbers/3.txt in a new tab + And I run :tab-move + + Then the following tabs should be open: + - data/numbers/3.txt (active) + - data/numbers/1.txt + - data/numbers/2.txt + + Scenario: :tab-move with relative position (negative), wrap and count + When I set tabs -> wrap to true + And I open data/numbers/1.txt + And I open data/numbers/2.txt in a new tab + And I open data/numbers/3.txt in a new tab + And I run :tab-focus 1 + And I run :tab-move - with count 8 + Then the following tabs should be open: + - data/numbers/2.txt + - data/numbers/1.txt (active) + - data/numbers/3.txt + Scenario: Make sure :tab-move retains metadata When I open data/title.html And I open data/hello.txt in a new tab