Merge branch 'modifcation-for-issue-1386' of https://github.com/adamwethington7/qutebrowser into adamwethington7-modifcation-for-issue-1386
This commit is contained in:
commit
5b396dab26
@ -172,6 +172,9 @@ class CommandRunner(QObject):
|
|||||||
log.commands.debug("Re-parsing with '{}'.".format(new_cmd))
|
log.commands.debug("Re-parsing with '{}'.".format(new_cmd))
|
||||||
return self.parse(new_cmd, aliases=False, fallback=fallback,
|
return self.parse(new_cmd, aliases=False, fallback=fallback,
|
||||||
keep=keep)
|
keep=keep)
|
||||||
|
|
||||||
|
cmdstr = self._completion_match(cmdstr)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
cmd = cmdutils.cmd_dict[cmdstr]
|
cmd = cmdutils.cmd_dict[cmdstr]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
@ -196,6 +199,23 @@ class CommandRunner(QObject):
|
|||||||
cmdline = [cmdstr] + args[:]
|
cmdline = [cmdstr] + args[:]
|
||||||
return ParseResult(cmd=cmd, args=args, cmdline=cmdline, count=count)
|
return ParseResult(cmd=cmd, args=args, cmdline=cmdline, count=count)
|
||||||
|
|
||||||
|
def _completion_match(self, cmdstr):
|
||||||
|
"""Replace cmdstr with a matching completion if there's only one match.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
cmdstr: The string representing the entered command so far
|
||||||
|
|
||||||
|
Return:
|
||||||
|
cmdstr modified to the matching completion or unmodified
|
||||||
|
"""
|
||||||
|
matches = []
|
||||||
|
for valid_command in cmdutils.cmd_dict.keys():
|
||||||
|
if valid_command.find(cmdstr) == 0:
|
||||||
|
matches.append(valid_command)
|
||||||
|
if len(matches) == 1:
|
||||||
|
cmdstr = matches[0]
|
||||||
|
return cmdstr
|
||||||
|
|
||||||
def _split_args(self, cmd, argstr, keep):
|
def _split_args(self, cmd, argstr, keep):
|
||||||
"""Split the arguments from an arg string.
|
"""Split the arguments from an arg string.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user