Keep pinned tabs in place rather than moving them.
This commit is contained in:
parent
3e3f4b4164
commit
2ae1bfc033
@ -831,13 +831,14 @@ Duplicate the current tab.
|
|||||||
|
|
||||||
[[tab-close]]
|
[[tab-close]]
|
||||||
=== tab-close
|
=== tab-close
|
||||||
Syntax: +:tab-close [*--prev*] [*--next*] [*--opposite*]+
|
Syntax: +:tab-close [*--prev*] [*--next*] [*--opposite*] [*--force*]+
|
||||||
|
|
||||||
Close the current/[count]th tab.
|
Close the current/[count]th tab.
|
||||||
|
|
||||||
==== optional arguments
|
==== optional arguments
|
||||||
* +*-p*+, +*--prev*+: Force selecting the tab before the current tab.
|
* +*-p*+, +*--prev*+: Force selecting the tab before the current tab.
|
||||||
* +*-n*+, +*--next*+: Force selecting the tab after the current tab.
|
* +*-n*+, +*--next*+: Force selecting the tab after the current tab.
|
||||||
|
* +*-f*+, +*--force*+: Avoid confirmation for pinned tabs.
|
||||||
* +*-o*+, +*--opposite*+: Force selecting the tab in the opposite direction of what's configured in 'tabs->select-on-remove'.
|
* +*-o*+, +*--opposite*+: Force selecting the tab in the opposite direction of what's configured in 'tabs->select-on-remove'.
|
||||||
|
|
||||||
|
|
||||||
|
@ -257,28 +257,22 @@ class CommandDispatcher:
|
|||||||
|
|
||||||
@cmdutils.register(instance='command-dispatcher', scope='window',
|
@cmdutils.register(instance='command-dispatcher', scope='window',
|
||||||
name='tab-pin')
|
name='tab-pin')
|
||||||
@cmdutils.argument('index')
|
|
||||||
@cmdutils.argument('count', count=True)
|
@cmdutils.argument('count', count=True)
|
||||||
def tab_pin(self, index=None, count=None):
|
def tab_pin(self, count=None):
|
||||||
"""Pin/Unpin the current tab.
|
"""Pin/Unpin the current tab.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
index: Location where the tab should be pinned/unpinned.
|
|
||||||
count: The tab index to pin or unpin, or None
|
count: The tab index to pin or unpin, or None
|
||||||
"""
|
"""
|
||||||
tabbar = self._tabbed_browser.tabBar()
|
|
||||||
tab = self._cntwidget(count)
|
tab = self._cntwidget(count)
|
||||||
if tab is None:
|
if tab is None:
|
||||||
return
|
return
|
||||||
|
|
||||||
tab.data.pinned = not tab.data.pinned
|
tab.data.pinned = not tab.data.pinned
|
||||||
if tab.data.pinned:
|
|
||||||
index = tabbar.pinned_count + 1 if index is None else int(index)
|
|
||||||
else:
|
|
||||||
index = self._count() if index is None else int(index)
|
|
||||||
|
|
||||||
self.tab_move(index)
|
tab_index = self._current_index() if count is None else count - 1
|
||||||
self._tabbed_browser.set_tab_pinned(self._current_index(),
|
cmdutils.check_overflow(tab_index + 1, 'int')
|
||||||
|
self._tabbed_browser.set_tab_pinned(tab_index,
|
||||||
tab.data.pinned)
|
tab.data.pinned)
|
||||||
|
|
||||||
@cmdutils.register(instance='command-dispatcher', name='open',
|
@cmdutils.register(instance='command-dispatcher', name='open',
|
||||||
|
@ -375,18 +375,15 @@ Feature: Saving and loading sessions
|
|||||||
When I open data/numbers/1.txt
|
When I open data/numbers/1.txt
|
||||||
And I open data/numbers/2.txt in a new tab
|
And I open data/numbers/2.txt in a new tab
|
||||||
And I open data/numbers/3.txt in a new tab
|
And I open data/numbers/3.txt in a new tab
|
||||||
And I run :tab-prev
|
And I run :run-with-count 2 :tab-pin
|
||||||
And I run :tab-pin
|
|
||||||
And I run :tab-next
|
|
||||||
And I run :session-save pin_session
|
And I run :session-save pin_session
|
||||||
And I run :tab-only
|
And I run :tab-only
|
||||||
And I run :tab-close --force
|
And I run :tab-close --force
|
||||||
And I run :session-load -c pin_session
|
And I run :session-load -c pin_session
|
||||||
And I run :tab-prev
|
And I run :tab-prev
|
||||||
And I run :open data/numbers/4.txt
|
And I run :open data/numbers/4.txt
|
||||||
And I wait 10s
|
|
||||||
Then the message "Tab is pinned!" should be shown
|
Then the message "Tab is pinned!" should be shown
|
||||||
And the following tabs should be open:
|
And the following tabs should be open:
|
||||||
- data/numbers/2.txt (active)
|
|
||||||
- data/numbers/1.txt
|
- data/numbers/1.txt
|
||||||
|
- data/numbers/2.txt (active)
|
||||||
- data/numbers/3.txt
|
- data/numbers/3.txt
|
||||||
|
@ -1035,9 +1035,9 @@ Feature: Tab management
|
|||||||
And I open data/numbers/3.txt in a new tab
|
And I open data/numbers/3.txt in a new tab
|
||||||
And I run :tab-pin
|
And I run :tab-pin
|
||||||
Then the following tabs should be open:
|
Then the following tabs should be open:
|
||||||
- data/numbers/3.txt (active)
|
|
||||||
- data/numbers/1.txt
|
- data/numbers/1.txt
|
||||||
- data/numbers/2.txt
|
- data/numbers/2.txt
|
||||||
|
- data/numbers/3.txt (active)
|
||||||
|
|
||||||
Scenario: :tab-pin unpin
|
Scenario: :tab-pin unpin
|
||||||
When I open data/numbers/1.txt
|
When I open data/numbers/1.txt
|
||||||
@ -1054,22 +1054,11 @@ Feature: Tab management
|
|||||||
When I open data/numbers/1.txt
|
When I open data/numbers/1.txt
|
||||||
And I open data/numbers/2.txt in a new tab
|
And I open data/numbers/2.txt in a new tab
|
||||||
And I open data/numbers/3.txt in a new tab
|
And I open data/numbers/3.txt in a new tab
|
||||||
And I run :tab-pin 2
|
And I run :run-with-count 2 :tab-pin
|
||||||
Then the following tabs should be open:
|
Then the following tabs should be open:
|
||||||
- data/numbers/1.txt
|
- data/numbers/1.txt
|
||||||
- data/numbers/3.txt (active)
|
|
||||||
- data/numbers/2.txt
|
- data/numbers/2.txt
|
||||||
|
|
||||||
Scenario: :tab-pin unpin to index 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-pin
|
|
||||||
And I run :tab-pin 1
|
|
||||||
Then the following tabs should be open:
|
|
||||||
- data/numbers/3.txt (active)
|
- data/numbers/3.txt (active)
|
||||||
- data/numbers/1.txt
|
|
||||||
- data/numbers/2.txt
|
|
||||||
|
|
||||||
Scenario: Pinned :tab-close prompt yes
|
Scenario: Pinned :tab-close prompt yes
|
||||||
When I open data/numbers/1.txt
|
When I open data/numbers/1.txt
|
||||||
|
Loading…
Reference in New Issue
Block a user