summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Bruhin <git@the-compiler.org>2014-12-11 22:16:56 +0100
committerFlorian Bruhin <git@the-compiler.org>2014-12-11 22:16:56 +0100
commitaefa637bc58f2bacd2702c73edff499bb0afd6e8 (patch)
tree00d33f7937986ff8891c00f24d465aaf047b9277
parentcba120ac7646fc7ad8c18a1d24826051dffe549d (diff)
downloadqutebrowser-aefa637bc58f2bacd2702c73edff499bb0afd6e8.tar.gz
qutebrowser-aefa637bc58f2bacd2702c73edff499bb0afd6e8.zip
Check if command text is valid when hinting.
-rw-r--r--qutebrowser/browser/hints.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/qutebrowser/browser/hints.py b/qutebrowser/browser/hints.py
index 1717cc7ef..5f588db17 100644
--- a/qutebrowser/browser/hints.py
+++ b/qutebrowser/browser/hints.py
@@ -30,7 +30,7 @@ from PyQt5.QtWidgets import QApplication
from PyQt5.QtWebKit import QWebElement
from qutebrowser.config import config
-from qutebrowser.keyinput import modeman
+from qutebrowser.keyinput import modeman, modeparsers
from qutebrowser.browser import webelem
from qutebrowser.commands import userscripts, cmdexc, cmdutils
from qutebrowser.utils import usertypes, log, qtutils, message, objreg
@@ -401,7 +401,13 @@ class HintManager(QObject):
"""
urlstr = url.toDisplayString(QUrl.FullyEncoded)
args = context.get_args(urlstr)
- message.set_cmd_text(self._win_id, ' '.join(args))
+ text = ' '.join(args)
+ if text[0] not in modeparsers.STARTCHARS:
+ message.error(self._win_id,
+ "Invalid command text '{}'.".format(text),
+ immediately=True)
+ else:
+ message.set_cmd_text(self._win_id, text)
def _download(self, elem, context):
"""Download a hint URL.