Merge branch 'haasn-winonly'

This commit is contained in:
Florian Bruhin 2016-08-16 11:08:04 +02:00
commit 0058917b8d
10 changed files with 51 additions and 38 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

@ -169,13 +169,13 @@ Contributors, sorted by the number of commits in descending order:
* Alexey "Averrin" Nabrodov
* avk
* ZDarian
* Niklas Haas
* Milan Svoboda
* John ShaggyTwoDope Jenkins
* Peter Vilim
* Clayton Craft
* nanjekyejoannah
* Oliver Caldwell
* Niklas Haas
* Jonas Schürmann
* error800
* Michael Hoang

View File

@ -68,6 +68,7 @@
|<<unbind,unbind>>|Unbind a keychain.
|<<undo,undo>>|Re-open a closed tab (optionally skipping [count] closed tabs).
|<<view-source,view-source>>|Show the source of the current page.
|<<window-only,window-only>>|Close all windows except for the current one.
|<<wq,wq>>|Save open pages and quit.
|<<yank,yank>>|Yank something to the clipboard or primary selection.
|<<zoom,zoom>>|Set the zoom level for the current tab.
@ -844,6 +845,10 @@ Re-open a closed tab (optionally skipping [count] closed tabs).
=== view-source
Show the source of the current page.
[[window-only]]
=== window-only
Close all windows except for the current one.
[[wq]]
=== wq
Syntax: +:wq ['name']+

View File

@ -247,3 +247,12 @@ def log_capacity(capacity: int):
raise cmdexc.CommandError("Can't set a negative log capacity!")
else:
log.ram_handler.change_log_capacity(capacity)
@cmdutils.register()
@cmdutils.argument('current_win_id', win_id=True)
def window_only(current_win_id):
"""Close all windows except for the current one."""
for win_id, window in objreg.window_registry.items():
if win_id != current_win_id:
window.close()

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