Don't explicitely fill commandline

This commit is contained in:
Florian Bruhin 2014-07-29 01:04:17 +02:00
parent 265019650b
commit 016e8f3c8d
2 changed files with 6 additions and 20 deletions

View File

@ -597,11 +597,11 @@ DATA = OrderedDict([
('keybind', sect.ValueList(
types.KeyBindingName(), types.KeyBinding(),
('o', 'open'),
('o', 'set-cmd-text ":open "'),
('go', 'set-cmd-text :open {url}'),
('O', 'open-tab'),
('O', 'set-cmd-text ":open-tab "'),
('gO', 'set-cmd-text :open-tab {url}'),
('xo', 'open-tab-bg'),
('xo', 'set-cmd-text ":open-tab-bg "'),
('xO', 'set-cmd-text :open-tab-bg {url}'),
('ga', 'open-tab about:blank'),
('d', 'tab-close'),

View File

@ -23,8 +23,7 @@ from qutebrowser.keyinput.basekeyparser import BaseKeyParser
import qutebrowser.utils.message as message
from qutebrowser.commands.managers import CommandManager
from qutebrowser.commands.exceptions import (
ArgumentCountError, CommandMetaError, CommandError)
from qutebrowser.commands.exceptions import CommandMetaError, CommandError
class CommandKeyParser(BaseKeyParser):
@ -40,25 +39,12 @@ class CommandKeyParser(BaseKeyParser):
super().__init__(parent, supports_count, supports_chains)
self.commandmanager = CommandManager()
def _run_or_fill(self, cmdstr, count=None):
"""Run the command in cmdstr or fill the statusbar if args missing.
Args:
cmdstr: The command string.
count: Optional command count.
"""
def execute(self, cmdstr, _keytype, count=None):
try:
self.commandmanager.run(cmdstr, count=count)
except ArgumentCountError:
self._debug_log("Filling statusbar with partial command {}".format(
cmdstr))
message.set_cmd_text(':{} '.format(cmdstr))
self.commandmanager.run(cmdstr, count)
except (CommandMetaError, CommandError) as e:
message.error(e, immediately=True)
def execute(self, cmdstr, _keytype, count=None):
self._run_or_fill(cmdstr, count)
class PassthroughKeyParser(CommandKeyParser):