Merge branch 'rcorre-hint_spawn_fix'

This commit is contained in:
Florian Bruhin 2016-05-30 16:18:17 +02:00
commit 9695828608
7 changed files with 54 additions and 8 deletions

View File

@ -58,6 +58,8 @@ Changed
Fixed Fixed
----- -----
- Fixed using `:hint links spawn` with flags - you can now use things like the
`-v` argument for `:spawn` or pass flags to the spawned commands.
- Various fixes for hinting corner-cases where following a link didn't work - Various fixes for hinting corner-cases where following a link didn't work
- Fixed crash when downloading from an URL with SSL errors - Fixed crash when downloading from an URL with SSL errors
- Close file handles correctly when a download failed - Close file handles correctly when a download failed

View File

@ -140,8 +140,8 @@ Contributors, sorted by the number of commits in descending order:
* Florian Bruhin * Florian Bruhin
* Daniel Schadt * Daniel Schadt
* Antoni Boucher * Antoni Boucher
* Lamar Pavel
* Ryan Roden-Corrent * Ryan Roden-Corrent
* Lamar Pavel
* Bruno Oliveira * Bruno Oliveira
* Alexander Cogneau * Alexander Cogneau
* Felix Van der Jeugt * Felix Van der Jeugt

View File

@ -355,6 +355,10 @@ Start hinting.
`window`, `run`, `hover`, `userscript` and `spawn`. `window`, `run`, `hover`, `userscript` and `spawn`.
==== note
* This command does not split arguments after the last argument and handles quotes literally.
* With this command, +;;+ is interpreted literally instead of splitting off a second command.
[[home]] [[home]]
=== home === home
Open main startpage in current tab. Open main startpage in current tab.

View File

@ -36,7 +36,6 @@ from qutebrowser.keyinput import modeman, modeparsers
from qutebrowser.browser import webelem from qutebrowser.browser import webelem
from qutebrowser.commands import userscripts, cmdexc, cmdutils, runners from qutebrowser.commands import userscripts, cmdexc, cmdutils, runners
from qutebrowser.utils import usertypes, log, qtutils, message, objreg, utils from qutebrowser.utils import usertypes, log, qtutils, message, objreg, utils
from qutebrowser.misc import guiprocess
ElemTuple = collections.namedtuple('ElemTuple', ['elem', 'label']) ElemTuple = collections.namedtuple('ElemTuple', ['elem', 'label'])
@ -625,9 +624,8 @@ class HintManager(QObject):
""" """
urlstr = url.toString(QUrl.FullyEncoded | QUrl.RemovePassword) urlstr = url.toString(QUrl.FullyEncoded | QUrl.RemovePassword)
args = context.get_args(urlstr) args = context.get_args(urlstr)
cmd, *args = args commandrunner = runners.CommandRunner(self._win_id)
proc = guiprocess.GUIProcess(self._win_id, what='command', parent=self) commandrunner.run_safely('spawn ' + ' '.join(args))
proc.start(cmd, args)
def _resolve_url(self, elem, baseurl): def _resolve_url(self, elem, baseurl):
"""Resolve a URL and check if we want to keep it. """Resolve a URL and check if we want to keep it.
@ -781,7 +779,7 @@ class HintManager(QObject):
webview.openurl(url) webview.openurl(url)
@cmdutils.register(instance='hintmanager', scope='tab', name='hint', @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) @cmdutils.argument('win_id', win_id=True)
def start(self, rapid=False, group=webelem.Group.all, target=Target.normal, def start(self, rapid=False, group=webelem.Group.all, target=Target.normal,
*args, win_id): *args, win_id):

View File

@ -0,0 +1,3 @@
#!/bin/bash
echo "message-info '$QUTE_SELECTED_TEXT'" >> "$QUTE_FIFO"

View File

@ -124,6 +124,7 @@ def run_command(quteproc, httpbin, command):
else: else:
count = None count = None
command = command.replace('(port)', str(httpbin.port)) command = command.replace('(port)', str(httpbin.port))
command = command.replace('(testdata)', utils.abs_datapath())
quteproc.send_cmd(command, count=count) quteproc.send_cmd(command, count=count)

View File

@ -44,12 +44,50 @@ Feature: Using hints
And I run :fake-key -g <Esc> And I run :fake-key -g <Esc>
Then no crash should happen 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) Scenario: Using :hint spawn with flags (issue 797)
When I open data/hints/html/simple.html When I open data/hints/html/simple.html
And I run :hint all spawn -v echo And I run :hint all spawn -v echo
And I run :follow-hint a 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
@posix
Scenario: Using :hint spawn with flags passed to the command (issue 797)
When I open data/hints/html/simple.html
And I run :hint --rapid all spawn -v echo -e foo
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 "<Enter>"
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) Scenario: Yanking to primary selection without it being supported (#1336)
When selection is not supported When selection is not supported