Merge branch 'forkbong-tab-move-wrap'

This commit is contained in:
Florian Bruhin 2015-12-02 06:21:02 +01:00
commit 71d1aed041
3 changed files with 29 additions and 2 deletions

View File

@ -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

View File

@ -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))

View File

@ -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