From de3460da3e545ca34fd105922ef85e02f6d076b1 Mon Sep 17 00:00:00 2001 From: Panagiotis Ktistakis Date: Wed, 2 Dec 2015 03:17:54 +0200 Subject: [PATCH 1/4] Wrap tabs on :tab-move +/- if tabs->wrap is true. --- qutebrowser/browser/commands.py | 2 ++ tests/integration/features/tabs.feature | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/qutebrowser/browser/commands.py b/qutebrowser/browser/commands.py index 6c48a0afe..4fad5f8fb 100644 --- a/qutebrowser/browser/commands.py +++ b/qutebrowser/browser/commands.py @@ -900,6 +900,8 @@ 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 = 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..d40c4c70a 100644 --- a/tests/integration/features/tabs.feature +++ b/tests/integration/features/tabs.feature @@ -384,7 +384,8 @@ 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 From 6e8ac374dd9e763f69ffacc2ab2247140c68308c Mon Sep 17 00:00:00 2001 From: Panagiotis Ktistakis Date: Wed, 2 Dec 2015 03:20:22 +0200 Subject: [PATCH 2/4] Add tests for :tab-move wrapping. --- tests/integration/features/tabs.feature | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/integration/features/tabs.feature b/tests/integration/features/tabs.feature index d40c4c70a..97ea18704 100644 --- a/tests/integration/features/tabs.feature +++ b/tests/integration/features/tabs.feature @@ -392,6 +392,29 @@ Feature: Tab management 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 From eeadeb400cbea96dc3713ea3a2afcdb051b84eda Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 2 Dec 2015 06:20:41 +0100 Subject: [PATCH 3/4] Style fix. --- qutebrowser/browser/commands.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/qutebrowser/browser/commands.py b/qutebrowser/browser/commands.py index 4fad5f8fb..f36f9172b 100644 --- a/qutebrowser/browser/commands.py +++ b/qutebrowser/browser/commands.py @@ -900,8 +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 = new_idx % self._count() + new_idx %= self._count() else: # pragma: no cover raise ValueError("Invalid direction '{}'!".format(direction)) From 91fcc910928723a60472a58d8d83d42f59bd39de Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 2 Dec 2015 06:20:53 +0100 Subject: [PATCH 4/4] Regenerate authors. --- README.asciidoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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