From d01a0b1d64a4178c20133a77954eff8b84d4d7f9 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Sun, 28 Jan 2018 13:05:49 +0100 Subject: [PATCH] Fix :bookmark-add with no URL --- doc/changelog.asciidoc | 2 ++ doc/help/commands.asciidoc | 3 ++- qutebrowser/browser/commands.py | 5 +++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/doc/changelog.asciidoc b/doc/changelog.asciidoc index c9cb327b3..7f22dc694 100644 --- a/doc/changelog.asciidoc +++ b/doc/changelog.asciidoc @@ -51,6 +51,8 @@ Fixed - QtWebKit: `:view-source` now displays a valid URL. - URLs containing ampersands and other special chars are now shown correctly when filtering them in the completion. +- `:bookmark-add "" foo` can now be used to save the current URL with a custom + title. v1.1.1 ------ diff --git a/doc/help/commands.asciidoc b/doc/help/commands.asciidoc index 1b65dbdd7..a87dc2304 100644 --- a/doc/help/commands.asciidoc +++ b/doc/help/commands.asciidoc @@ -176,7 +176,8 @@ Save the current page as a bookmark, or a specific url. If no url and title are provided, then save the current page as a bookmark. If a url and title have been provided, then save the given url as a bookmark with the provided title. You can view all saved bookmarks on the link:qute://bookmarks[bookmarks page]. ==== positional arguments -* +'url'+: url to save as a bookmark. If None, use url of current page. +* +'url'+: url to save as a bookmark. If not given, use url of current page. + * +'title'+: title of the new bookmark. ==== optional arguments diff --git a/qutebrowser/browser/commands.py b/qutebrowser/browser/commands.py index fdd552b32..a0c5e63ff 100644 --- a/qutebrowser/browser/commands.py +++ b/qutebrowser/browser/commands.py @@ -1349,7 +1349,8 @@ class CommandDispatcher: link:qute://bookmarks[bookmarks page]. Args: - url: url to save as a bookmark. If None, use url of current page. + url: url to save as a bookmark. If not given, use url of current + page. title: title of the new bookmark. toggle: remove the bookmark instead of raising an error if it already exists. @@ -1358,7 +1359,7 @@ class CommandDispatcher: raise cmdexc.CommandError('Title must be provided if url has ' 'been provided') bookmark_manager = objreg.get('bookmark-manager') - if url is None: + if not url: url = self._current_url() else: try: