diff --git a/qutebrowser/browser/hints.py b/qutebrowser/browser/hints.py index b28da90af..d12a05a12 100644 --- a/qutebrowser/browser/hints.py +++ b/qutebrowser/browser/hints.py @@ -36,7 +36,6 @@ from qutebrowser.keyinput import modeman, modeparsers from qutebrowser.browser import webelem from qutebrowser.commands import userscripts, cmdexc, cmdutils, runners from qutebrowser.utils import usertypes, log, qtutils, message, objreg, utils -from qutebrowser.misc import guiprocess ElemTuple = collections.namedtuple('ElemTuple', ['elem', 'label']) @@ -625,9 +624,8 @@ class HintManager(QObject): """ urlstr = url.toString(QUrl.FullyEncoded | QUrl.RemovePassword) args = context.get_args(urlstr) - cmd, *args = args - proc = guiprocess.GUIProcess(self._win_id, what='command', parent=self) - proc.start(cmd, args) + commandrunner = runners.CommandRunner(self._win_id) + commandrunner.run_safely('spawn ' + ' '.join(args)) def _resolve_url(self, elem, baseurl): """Resolve a URL and check if we want to keep it. @@ -781,7 +779,7 @@ class HintManager(QObject): webview.openurl(url) @cmdutils.register(instance='hintmanager', scope='tab', name='hint', - star_args_optional=True) + star_args_optional=True, maxsplit=2) @cmdutils.argument('win_id', win_id=True) def start(self, rapid=False, group=webelem.Group.all, target=Target.normal, *args, win_id): diff --git a/tests/end2end/features/conftest.py b/tests/end2end/features/conftest.py index 8a611e23a..b9fdd27e9 100644 --- a/tests/end2end/features/conftest.py +++ b/tests/end2end/features/conftest.py @@ -124,6 +124,7 @@ def run_command(quteproc, httpbin, command): else: count = None command = command.replace('(port)', str(httpbin.port)) + command = command.replace('(testdata)', utils.abs_datapath()) quteproc.send_cmd(command, count=count) diff --git a/tests/end2end/features/hints.feature b/tests/end2end/features/hints.feature index ea1ae7ea6..8868e87dc 100644 --- a/tests/end2end/features/hints.feature +++ b/tests/end2end/features/hints.feature @@ -44,12 +44,43 @@ Feature: Using hints And I run :fake-key -g Then no crash should happen - @xfail + Scenario: Using :hint spawn with flags and -- (issue 797) + When I open data/hints/html/simple.html + And I run :hint -- all spawn -v echo + And I run :follow-hint a + Then the message "Command exited successfully." should be shown + Scenario: Using :hint spawn with flags (issue 797) When I open data/hints/html/simple.html And I run :hint all spawn -v echo And I run :follow-hint a - Then the message "Command exited successfully" should be shown + Then the message "Command exited successfully." should be shown + + Scenario: Using :hint spawn with flags and --rapid (issue 797) + When I open data/hints/html/simple.html + And I run :hint --rapid all spawn -v echo + And I run :follow-hint a + Then the message "Command exited successfully." should be shown + + Scenario: Using :hint run + When I open data/hints/html/simple.html + And I run :hint all run message-info {hint-url} + And I run :follow-hint a + Then the message "http://localhost:(port)/data/hello.txt" should be shown + + Scenario: Using :hint fill + When I open data/hints/html/simple.html + And I run :hint all fill :message-info {hint-url} + And I run :follow-hint a + And I press the key "" + Then the message "http://localhost:(port)/data/hello.txt" should be shown + + @posix + Scenario: Using :hint userscript + When I open data/hints/html/simple.html + And I run :hint all userscript (testdata)/userscripts/echo_hint_text + And I run :follow-hint a + Then the message "Follow me!" should be shown Scenario: Yanking to primary selection without it being supported (#1336) When selection is not supported diff --git a/tests/integration/data/userscripts/echo_hint_text b/tests/integration/data/userscripts/echo_hint_text new file mode 100755 index 000000000..69b69ecff --- /dev/null +++ b/tests/integration/data/userscripts/echo_hint_text @@ -0,0 +1,3 @@ +#!/bin/bash + +echo "message-info '$QUTE_SELECTED_TEXT'" >> "$QUTE_FIFO"