Add :window-only command
I mainly added this so I can speed up all of the tests that rely on closing other windows.
This commit is contained in:
parent
b51dffc517
commit
d5080bdb1a
@ -32,6 +32,7 @@ Added
|
|||||||
in rapid mode.
|
in rapid mode.
|
||||||
- New `{clipboard}` and `{primary}` replacements for the commandline which
|
- New `{clipboard}` and `{primary}` replacements for the commandline which
|
||||||
replace the `:paste` command.
|
replace the `:paste` command.
|
||||||
|
- New `:window-only` command to close all other windows.
|
||||||
|
|
||||||
Changed
|
Changed
|
||||||
~~~~~~~
|
~~~~~~~
|
||||||
|
@ -769,6 +769,13 @@ class CommandDispatcher:
|
|||||||
raise cmdexc.CommandError("Can't zoom {}%!".format(level))
|
raise cmdexc.CommandError("Can't zoom {}%!".format(level))
|
||||||
message.info(self._win_id, "Zoom level: {}%".format(level))
|
message.info(self._win_id, "Zoom level: {}%".format(level))
|
||||||
|
|
||||||
|
@cmdutils.register(instance='command-dispatcher', scope='window')
|
||||||
|
def window_only(self):
|
||||||
|
"""Close all windows except for the current one."""
|
||||||
|
for win_id, window in objreg.window_registry.items():
|
||||||
|
if win_id != self._win_id:
|
||||||
|
window.close()
|
||||||
|
|
||||||
@cmdutils.register(instance='command-dispatcher', scope='window')
|
@cmdutils.register(instance='command-dispatcher', scope='window')
|
||||||
def tab_only(self, left=False, right=False):
|
def tab_only(self, left=False, right=False):
|
||||||
"""Close all tabs except for the current one.
|
"""Close all tabs except for the current one.
|
||||||
|
@ -525,6 +525,20 @@ Feature: Various utility commands.
|
|||||||
- data/hints/link_blank.html
|
- data/hints/link_blank.html
|
||||||
- data/hello.txt (active)
|
- data/hello.txt (active)
|
||||||
|
|
||||||
|
@no_xvfb
|
||||||
|
Scenario: :window-only
|
||||||
|
Given I run :tab-only
|
||||||
|
And I open data/hello.txt
|
||||||
|
When I open data/hello2.txt in a new tab
|
||||||
|
And I open data/hello3.txt in a new window
|
||||||
|
And I run :window-only
|
||||||
|
Then the session should look like:
|
||||||
|
windows:
|
||||||
|
- tabs:
|
||||||
|
- active: true
|
||||||
|
history:
|
||||||
|
- url: http://localhost:*/data/hello3.txt
|
||||||
|
|
||||||
## Variables
|
## Variables
|
||||||
|
|
||||||
Scenario: {url} as part of an argument
|
Scenario: {url} as part of an argument
|
||||||
|
Loading…
Reference in New Issue
Block a user