Enter KeyMode.normal directly in ModeManager.

We used to enter KeyMode.none and then with a zero-time singleShot QTimer enter
the normal mode. This doesn't really make sense, and caused an exception if a
keypress was processed before the timer fired.

Fixes #433.
This commit is contained in:
Florian Bruhin 2015-01-09 20:25:04 +01:00
parent d147ba90d4
commit a412814dee
3 changed files with 3 additions and 6 deletions

View File

@ -150,7 +150,7 @@ class ModeManager(QObject):
self._win_id = win_id self._win_id = win_id
self._handlers = {} self._handlers = {}
self.passthrough = [] self.passthrough = []
self.mode = usertypes.KeyMode.none self.mode = usertypes.KeyMode.normal
self._releaseevents_to_pass = [] self._releaseevents_to_pass = []
self._forward_unbound_keys = config.get( self._forward_unbound_keys = config.get(
'input', 'forward-unbound-keys') 'input', 'forward-unbound-keys')

View File

@ -22,7 +22,6 @@
import binascii import binascii
import base64 import base64
import itertools import itertools
import functools
from PyQt5.QtCore import pyqtSlot, QRect, QPoint, QTimer, Qt from PyQt5.QtCore import pyqtSlot, QRect, QPoint, QTimer, Qt
from PyQt5.QtWidgets import QWidget, QVBoxLayout from PyQt5.QtWidgets import QWidget, QVBoxLayout
@ -112,8 +111,6 @@ class MainWindow(QWidget):
modeman.init(self.win_id, self) modeman.init(self.win_id, self)
self._connect_signals() self._connect_signals()
QTimer.singleShot(0, functools.partial(
modeman.enter, win_id, usertypes.KeyMode.normal, 'init'))
# When we're here the statusbar might not even really exist yet, so # When we're here the statusbar might not even really exist yet, so
# resizing will fail. Therefore, we use singleShot QTimers to make sure # resizing will fail. Therefore, we use singleShot QTimers to make sure

View File

@ -230,8 +230,8 @@ ClickTarget = enum('ClickTarget', ['normal', 'tab', 'tab_bg', 'window'])
# Key input modes # Key input modes
KeyMode = enum('KeyMode', ['none', 'normal', 'hint', 'command', 'yesno', KeyMode = enum('KeyMode', ['normal', 'hint', 'command', 'yesno', 'prompt',
'prompt', 'insert', 'passthrough']) 'insert', 'passthrough'])
# Available command completions # Available command completions