Merge branch 'axiom-tab-focus-negative-index'
This commit is contained in:
commit
9e8302ed5c
@ -22,6 +22,12 @@ Added
|
|||||||
|
|
||||||
- New `:edit-url` command to edit the URL in an external editor.
|
- New `:edit-url` command to edit the URL in an external editor.
|
||||||
|
|
||||||
|
Changed
|
||||||
|
~~~~~~~
|
||||||
|
|
||||||
|
- `:tab-focus` can now take a negative index to focus the nth tab counted from
|
||||||
|
the right.
|
||||||
|
|
||||||
v0.6.0
|
v0.6.0
|
||||||
------
|
------
|
||||||
|
|
||||||
|
@ -218,6 +218,7 @@ Contributors, sorted by the number of commits in descending order:
|
|||||||
* Samuel Loury
|
* Samuel Loury
|
||||||
* Matthias Lisin
|
* Matthias Lisin
|
||||||
* Marcel Schilling
|
* Marcel Schilling
|
||||||
|
* Johannes Martinsson
|
||||||
* Jean-Christophe Petkovich
|
* Jean-Christophe Petkovich
|
||||||
* Jay Kamat
|
* Jay Kamat
|
||||||
* Helen Sherwood-Taylor
|
* Helen Sherwood-Taylor
|
||||||
|
@ -719,7 +719,8 @@ Select the tab given as argument/[count].
|
|||||||
If neither count nor index are given, it behaves like tab-next.
|
If neither count nor index are given, it behaves like tab-next.
|
||||||
|
|
||||||
==== positional arguments
|
==== positional arguments
|
||||||
* +'index'+: The tab index to focus, starting with 1. The special value `last` focuses the last focused tab.
|
* +'index'+: The tab index to focus, starting with 1. The special value `last` focuses the last focused tab. Negative indexes
|
||||||
|
counts from the end, such that -1 is the last tab.
|
||||||
|
|
||||||
|
|
||||||
==== count
|
==== count
|
||||||
|
@ -900,7 +900,8 @@ class CommandDispatcher:
|
|||||||
|
|
||||||
Args:
|
Args:
|
||||||
index: The tab index to focus, starting with 1. The special value
|
index: The tab index to focus, starting with 1. The special value
|
||||||
`last` focuses the last focused tab.
|
`last` focuses the last focused tab. Negative indexes
|
||||||
|
counts from the end, such that -1 is the last tab.
|
||||||
count: The tab index to focus, starting with 1.
|
count: The tab index to focus, starting with 1.
|
||||||
"""
|
"""
|
||||||
if index == 'last':
|
if index == 'last':
|
||||||
@ -909,6 +910,8 @@ class CommandDispatcher:
|
|||||||
if index is None and count is None:
|
if index is None and count is None:
|
||||||
self.tab_next()
|
self.tab_next()
|
||||||
return
|
return
|
||||||
|
if index is not None and index < 0:
|
||||||
|
index = self._count() + index + 1
|
||||||
try:
|
try:
|
||||||
idx = cmdutils.arg_or_count(index, count, default=1,
|
idx = cmdutils.arg_or_count(index, count, default=1,
|
||||||
countzero=self._count())
|
countzero=self._count())
|
||||||
|
@ -228,6 +228,34 @@ Feature: Tab management
|
|||||||
- data/numbers/2.txt
|
- data/numbers/2.txt
|
||||||
- data/numbers/3.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
|
||||||
|
And I open data/numbers/3.txt in a new tab
|
||||||
|
And I run :tab-focus 1
|
||||||
|
And I run :tab-focus -1
|
||||||
|
Then the following tabs should be open:
|
||||||
|
- data/numbers/1.txt
|
||||||
|
- data/numbers/2.txt
|
||||||
|
- data/numbers/3.txt (active)
|
||||||
|
|
||||||
|
Scenario: :tab-focus negative index
|
||||||
|
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 -2
|
||||||
|
Then the following tabs should be open:
|
||||||
|
- data/numbers/1.txt
|
||||||
|
- data/numbers/2.txt (active)
|
||||||
|
- data/numbers/3.txt
|
||||||
|
|
||||||
|
Scenario: :tab-focus with invalid negative index
|
||||||
|
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 -5
|
||||||
|
Then the error "There's no tab with index -1!" should be shown
|
||||||
|
|
||||||
Scenario: :tab-focus last with no last focused tab
|
Scenario: :tab-focus last with no last focused tab
|
||||||
Given I have a fresh instance
|
Given I have a fresh instance
|
||||||
And I run :tab-focus last
|
And I run :tab-focus last
|
||||||
|
Loading…
Reference in New Issue
Block a user