diff --git a/qutebrowser/commands/runners.py b/qutebrowser/commands/runners.py index 970fbadbe..ea10520dc 100644 --- a/qutebrowser/commands/runners.py +++ b/qutebrowser/commands/runners.py @@ -174,15 +174,6 @@ class CommandRunner(QObject): count = None return (count, cmdstr) - def _parse_fallback(self, text, count, keep): - """Parse the given commandline without a valid command.""" - if keep: - cmdstr, sep, argstr = text.partition(' ') - cmdline = [cmdstr, sep] + argstr.split() - else: - cmdline = text.split() - return ParseResult(cmd=None, args=None, cmdline=cmdline, count=count) - def parse(self, text, *, fallback=False, keep=False): """Split the commandline text into command and arguments. @@ -210,7 +201,9 @@ class CommandRunner(QObject): if not fallback: raise cmdexc.NoSuchCommandError( '{}: no such command'.format(cmdstr)) - return self._parse_fallback(text, count, keep) + cmdline = split.split(text, keep=keep) + return ParseResult(cmd=None, args=None, cmdline=cmdline, + count=count) args = self._split_args(cmd, argstr, keep) if keep and args: diff --git a/tests/unit/completion/test_completer.py b/tests/unit/completion/test_completer.py index 233ba5307..6bc651d4f 100644 --- a/tests/unit/completion/test_completer.py +++ b/tests/unit/completion/test_completer.py @@ -176,6 +176,7 @@ def _set_cmd_prompt(cmd, txt): usertypes.Completion.command)), (':set -t -p |', usertypes.Completion.section), (':open -- |', None), + (':gibberish nonesense |', None), ]) def test_update_completion(txt, expected, status_command_stub, completer_obj, completion_widget_stub):