Clean up pin_tab
Also add a test case for :pin-tab with an invalid count
This commit is contained in:
parent
302961a86a
commit
596dee69d6
@ -277,16 +277,9 @@ class CommandDispatcher:
|
||||
"""
|
||||
tab = self._cntwidget(count)
|
||||
if tab is None:
|
||||
return
|
||||
raise cmdexc.CommandError("Tab {} does not exist!".format(count))
|
||||
|
||||
to_pin = not tab.data.pinned
|
||||
tab_index = self._current_index() if count is None else count - 1
|
||||
cmdutils.check_overflow(tab_index + 1, 'int')
|
||||
tab = self._cntwidget(count)
|
||||
|
||||
if tab is None:
|
||||
raise cmdexc.CommandError("Unable to find tab '{}'.".format(count))
|
||||
|
||||
self._tabbed_browser.set_tab_pinned(tab, to_pin)
|
||||
|
||||
@cmdutils.register(instance='command-dispatcher', name='open',
|
||||
|
@ -1073,6 +1073,17 @@ Feature: Tab management
|
||||
- data/numbers/2.txt (pinned)
|
||||
- data/numbers/3.txt (active)
|
||||
|
||||
Scenario: :tab-pin with an invalid count
|
||||
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 with count 23
|
||||
Then the error "Tab 23 does not exist!" should be shown
|
||||
And the following tabs should be open:
|
||||
- data/numbers/1.txt
|
||||
- data/numbers/2.txt
|
||||
- data/numbers/3.txt (active)
|
||||
|
||||
Scenario: Pinned :tab-close prompt yes
|
||||
When I open data/numbers/1.txt
|
||||
And I run :tab-pin
|
||||
|
Loading…
Reference in New Issue
Block a user