Add generic PassthroughKeyParser, remove InsertKeyParser
This commit is contained in:
parent
035a6a0847
commit
b4033ced8b
@ -57,7 +57,7 @@ import qutebrowser.utils.message as message
|
||||
from qutebrowser.widgets.mainwindow import MainWindow
|
||||
from qutebrowser.widgets.crash import CrashDialog
|
||||
from qutebrowser.keyinput.normalmode import NormalKeyParser
|
||||
from qutebrowser.keyinput.insertmode import InsertKeyParser
|
||||
from qutebrowser.keyinput.keyparser import PassthroughKeyParser
|
||||
from qutebrowser.keyinput.hintmode import HintKeyParser
|
||||
from qutebrowser.commands.parsers import CommandParser, SearchParser
|
||||
from qutebrowser.utils.appdirs import AppDirs
|
||||
@ -127,7 +127,7 @@ class QuteBrowser(QApplication):
|
||||
self._keyparsers = {
|
||||
'normal': NormalKeyParser(self),
|
||||
'hint': HintKeyParser(self),
|
||||
'insert': InsertKeyParser(self),
|
||||
'insert': PassthroughKeyParser('keybind.insert', self),
|
||||
}
|
||||
self._init_cmds()
|
||||
self.mainwindow = MainWindow()
|
||||
|
@ -1,30 +0,0 @@
|
||||
# Copyright 2014 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
|
||||
#
|
||||
# This file is part of qutebrowser.
|
||||
#
|
||||
# qutebrowser is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# qutebrowser is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""KeyParser for "insert" mode."""
|
||||
|
||||
import qutebrowser.keyinput.modes as modes
|
||||
from qutebrowser.keyinput.keyparser import CommandKeyParser
|
||||
|
||||
|
||||
class InsertKeyParser(CommandKeyParser):
|
||||
|
||||
"""KeyParser for insert mode."""
|
||||
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent, supports_chains=False)
|
||||
self.read_config('keybind.insert')
|
@ -380,3 +380,20 @@ class CommandKeyParser(KeyParser):
|
||||
|
||||
def execute(self, cmdstr, _keytype, count=None):
|
||||
self._run_or_fill(cmdstr, count, ignore_exc=False)
|
||||
|
||||
|
||||
class PassthroughKeyParser(CommandKeyParser):
|
||||
|
||||
"""KeyChainParser which passes through normal keys.
|
||||
|
||||
Used for insert/passthrough modes.
|
||||
"""
|
||||
|
||||
def __init__(self, confsect, parent=None):
|
||||
"""Constructor.
|
||||
|
||||
Args:
|
||||
confsect: The config section to use.
|
||||
"""
|
||||
super().__init__(parent, supports_chains=False)
|
||||
self.read_config(confsect)
|
||||
|
Loading…
Reference in New Issue
Block a user