Merge branch 'winonly' of https://github.com/haasn/qutebrowser into haasn-winonly

This commit is contained in:
Florian Bruhin 2016-08-16 11:02:49 +02:00
commit 9d7d307aa5
8 changed files with 43 additions and 37 deletions

View File

@ -32,6 +32,7 @@ Added
in rapid mode.
- New `{clipboard}` and `{primary}` replacements for the commandline which
replace the `:paste` command.
- New `:window-only` command to close all other windows.
Changed
~~~~~~~

View File

@ -771,6 +771,13 @@ class CommandDispatcher:
raise cmdexc.CommandError("Can't zoom {}%!".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')
def tab_only(self, left=False, right=False):
"""Close all tabs except for the current one.

View File

@ -108,7 +108,7 @@ Feature: Going back and forward.
And the message "Still alive!" should be shown
Scenario: Going back in a new window
Given I have a fresh instance
Given I clean up open tabs
When I open data/backforward/1.txt
And I open data/backforward/2.txt
And I run :back -w

View File

@ -139,6 +139,15 @@ def fresh_instance(quteproc):
quteproc.start()
@bdd.given("I clean up open tabs")
def clean_open_tabs(quteproc):
"""Clean up open windows and tabs."""
quteproc.set_setting('tabs', 'last-close', 'blank')
quteproc.send_cmd(':window-only')
quteproc.send_cmd(':tab-only')
quteproc.send_cmd(':tab-close')
## When

View File

@ -525,6 +525,20 @@ Feature: Various utility commands.
- data/hints/link_blank.html
- 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
Scenario: {url} as part of an argument

View File

@ -263,8 +263,7 @@ Feature: Tab management
Then the error "There's no tab with index -1!" should be shown
Scenario: :tab-focus last with no last focused tab
Given I have a fresh instance
And I run :tab-focus last
When I run :tab-focus last
Then the error "No last focused tab!" should be shown
# tab-prev/tab-next
@ -564,7 +563,6 @@ Feature: Tab management
- data/hello2.txt
Scenario: Cloning to new window
Given I have a fresh instance
When I open data/title.html
And I run :tab-clone -w
Then the session should look like:
@ -583,7 +581,6 @@ Feature: Tab management
title: Test title
Scenario: Cloning with tabs-are-windows = true
Given I have a fresh instance
When I open data/title.html
And I set tabs -> tabs-are-windows to true
And I run :tab-clone
@ -605,7 +602,6 @@ Feature: Tab management
# :tab-detach
Scenario: Detaching a tab
Given I have a fresh instance
When I open data/numbers/1.txt
And I open data/numbers/2.txt in a new tab
And I run :tab-detach
@ -861,7 +857,6 @@ Feature: Tab management
# :buffer
Scenario: :buffer without args
Given I have a fresh instance
When I run :buffer
Then the error "buffer: The following arguments are required: index" should be shown
@ -914,8 +909,8 @@ Feature: Tab management
Scenario: :buffer with no matching window index
When I open data/title.html
And I run :buffer "2/1"
Then the error "There's no window with id 2!" should be shown
And I run :buffer "99/1"
Then the error "There's no window with id 99!" should be shown
Scenario: :buffer with matching window index
Given I have a fresh instance
@ -947,7 +942,6 @@ Feature: Tab management
- url: http://localhost:*/data/paste_primary.html
Scenario: :buffer with wrong argument (-1)
Given I have a fresh instance
When I open data/title.html
And I run :buffer "-1"
Then the error "There's no tab with index -1!" should be shown

View File

@ -19,10 +19,3 @@
import pytest_bdd as bdd
bdd.scenarios('tabs.feature')
@bdd.given("I clean up open tabs")
def clean_open_tabs(quteproc):
quteproc.set_setting('tabs', 'last-close', 'blank')
quteproc.send_cmd(':tab-only')
quteproc.send_cmd(':tab-close')

View File

@ -3,7 +3,7 @@ Feature: Yanking and pasting.
from/to the clipboard and primary selection.
Background:
Given I run :tab-only
Given I clean up open tabs
#### :yank
@ -79,9 +79,7 @@ Feature: Yanking and pasting.
Then the error "Clipboard is empty." should be shown
Scenario: Pasting in a new tab
Given I open about:blank
When I run :tab-only
And I put "http://localhost:(port)/data/hello.txt" into the clipboard
When I put "http://localhost:(port)/data/hello.txt" into the clipboard
And I run :open -t {clipboard}
And I wait until data/hello.txt is loaded
Then the following tabs should be open:
@ -89,9 +87,7 @@ Feature: Yanking and pasting.
- data/hello.txt (active)
Scenario: Pasting in a background tab
Given I open about:blank
When I run :tab-only
And I put "http://localhost:(port)/data/hello.txt" into the clipboard
When I put "http://localhost:(port)/data/hello.txt" into the clipboard
And I run :open -b {clipboard}
And I wait until data/hello.txt is loaded
Then the following tabs should be open:
@ -99,7 +95,6 @@ Feature: Yanking and pasting.
- data/hello.txt
Scenario: Pasting in a new window
Given I have a fresh instance
When I put "http://localhost:(port)/data/hello.txt" into the clipboard
And I run :open -w {clipboard}
And I wait until data/hello.txt is loaded
@ -123,7 +118,6 @@ Feature: Yanking and pasting.
Then the error "Invalid URL" should be shown
Scenario: Pasting multiple urls in a new tab
Given I have a fresh instance
When I put the following lines into the clipboard:
http://localhost:(port)/data/hello.txt
http://localhost:(port)/data/hello2.txt
@ -139,8 +133,8 @@ Feature: Yanking and pasting.
- data/hello3.txt
Scenario: Pasting multiline text
Given I have a fresh instance
When I set searchengines -> DEFAULT to http://localhost:(port)/data/hello.txt?q={}
When I set general -> auto-search to true
And I set searchengines -> DEFAULT to http://localhost:(port)/data/hello.txt?q={}
And I put the following lines into the clipboard:
this url:
http://qutebrowser.org
@ -152,9 +146,8 @@ Feature: Yanking and pasting.
- data/hello.txt?q=this%20url%3A%0Ahttp%3A//qutebrowser.org%0Ashould%20not%20open (active)
Scenario: Pasting multiline whose first line looks like a URI
Given I open about:blank
When I run :tab-only
When I set searchengines -> DEFAULT to http://localhost:(port)/data/hello.txt?q={}
When I set general -> auto-search to true
And I set searchengines -> DEFAULT to http://localhost:(port)/data/hello.txt?q={}
And I put the following lines into the clipboard:
text:
should open
@ -166,9 +159,7 @@ Feature: Yanking and pasting.
- data/hello.txt?q=text%3A%0Ashould%20open%0Aas%20search (active)
Scenario: Pasting multiple urls in a background tab
Given I open about:blank
When I run :tab-only
And I put the following lines into the clipboard:
When I put the following lines into the clipboard:
http://localhost:(port)/data/hello.txt
http://localhost:(port)/data/hello2.txt
http://localhost:(port)/data/hello3.txt
@ -183,7 +174,6 @@ Feature: Yanking and pasting.
- data/hello3.txt
Scenario: Pasting multiple urls in new windows
Given I have a fresh instance
When I put the following lines into the clipboard:
http://localhost:(port)/data/hello.txt
http://localhost:(port)/data/hello2.txt
@ -216,13 +206,11 @@ Feature: Yanking and pasting.
url: http://localhost:*/data/hello3.txt
Scenario: Pasting multiple urls with an empty one
When I open about:blank
And I put "http://localhost:(port)/data/hello.txt\n\nhttp://localhost:(port)/data/hello2.txt" into the clipboard
And I run :open -t {clipboard}
Then no crash should happen
Scenario: Pasting multiple urls with an almost empty one
When I open about:blank
And I put "http://localhost:(port)/data/hello.txt\n \nhttp://localhost:(port)/data/hello2.txt" into the clipboard
And I run :open -t {clipboard}
Then no crash should happen