Allow :open without URL with -t/-b/-w

This commit is contained in:
Florian Bruhin 2016-11-26 12:17:23 +01:00
parent ea44c6d4b9
commit 73c608dce7
3 changed files with 7 additions and 8 deletions

View File

@ -150,6 +150,7 @@ Changed
- `:hint` has a new `--add-history` argument to add the URL to the history for
yank/spawn targets.
- `:set` now cycles through values if more than one argument is given.
- `:open` now opens `default-page` without an URL even without `-t`/`-b`/`-w` given.
Deprecated
~~~~~~~~~~

View File

@ -257,13 +257,10 @@ class CommandDispatcher:
count: The tab index to open the URL in, or None.
"""
if url is None:
if tab or bg or window:
urls = [config.get('general', 'default-page')]
else:
raise cmdexc.CommandError("No URL given, but -t/-b/-w is not "
"set!")
urls = [config.get('general', 'default-page')]
else:
urls = self._parse_url_input(url)
for i, cur_url in enumerate(urls):
if not window and i > 0:
tab = False

View File

@ -14,9 +14,10 @@ Feature: Opening pages
- active: true
url: http://localhost:*/data/numbers/1.txt
Scenario: :open without URL and no -t/-b/-w
When I run :open
Then the error "No URL given, but -t/-b/-w is not set!" should be shown
Scenario: :open without URL
When I set general -> default-page to http://localhost:(port)/data/numbers/11.txt
And I run :open
Then data/numbers/11.txt should be loaded
Scenario: :open without URL and -t
When I set general -> default-page to http://localhost:(port)/data/numbers/2.txt