Make :set-cmd-text work without valid URL. Fixes #165.

This commit is contained in:
Florian Bruhin 2014-10-08 21:18:26 +02:00
parent b1ed3a1106
commit ffdc176d9d

View File

@ -170,12 +170,13 @@ class Command(misc.MinimalLineEditMixin, misc.CommandLineEdit):
""" """
tabbed_browser = objreg.get('tabbed-browser', scope='window', tabbed_browser = objreg.get('tabbed-browser', scope='window',
window=self._win_id) window=self._win_id)
if '{url}' in text:
url = tabbed_browser.current_url().toString( url = tabbed_browser.current_url().toString(
QUrl.FullyEncoded | QUrl.RemovePassword) QUrl.FullyEncoded | QUrl.RemovePassword)
# FIXME we currently replace the URL in any place in the arguments, # FIXME we currently replace the URL in any place in the arguments,
# rather than just replacing it if it is a dedicated argument. We could # rather than just replacing it if it is a dedicated argument. We
# split the args, but then trailing spaces would be lost, so I'm not # could split the args, but then trailing spaces would be lost, so
# sure what's the best thing to do here # I'm not sure what's the best thing to do here
# https://github.com/The-Compiler/qutebrowser/issues/123 # https://github.com/The-Compiler/qutebrowser/issues/123
text = text.replace('{url}', url) text = text.replace('{url}', url)
if not text[0] in modeparsers.STARTCHARS: if not text[0] in modeparsers.STARTCHARS: