Select the last focused tab when running ':tab-focus <current tab number>'

This commit is contained in:
Iordanis Grigoriou 2017-06-16 12:28:56 +02:00
parent 2ffb10badf
commit f28d523225
2 changed files with 15 additions and 2 deletions

View File

@ -1076,10 +1076,11 @@ class CommandDispatcher:
last tab.
count: The tab index to focus, starting with 1.
"""
if index == 'last':
index = count if count is not None else index
if index in ('last', self._current_index() + 1):
self._tab_focus_last()
return
index = count if count is not None else index
if index is None:
self.tab_next()

View File

@ -236,6 +236,18 @@ Feature: Tab management
- data/numbers/2.txt
- data/numbers/3.txt
Scenario: :tab-focus with current tab number
When 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-focus 3
And I run :tab-focus 1
Then the following tabs should be open:
- data/numbers/1.txt (active)
- data/numbers/2.txt
- data/numbers/3.txt
Scenario: :tab-focus with -1
When I open data/numbers/1.txt
And I open data/numbers/2.txt in a new tab