Merge branch 'bleed' of https://github.com/chrys87/fenrir into bleed

This commit is contained in:
Storm Dragon 2018-03-26 15:34:26 -04:00
commit 19bb646e0d

View File

@ -91,16 +91,24 @@ class fenrirManager():
if event['Data'] == b'': if event['Data'] == b'':
return return
self.environment['runtime']['commandManager'].executeDefaultTrigger('onByteInput') self.environment['runtime']['commandManager'].executeDefaultTrigger('onByteInput')
isCommand = False
if self.switchCtrlModeOnce > 0:
self.switchCtrlModeOnce -= 1
isControlMode = False
if self.controlMode and not self.switchCtrlModeOnce == 1 or\
not self.controlMode:
isControlMode = self.handleControlMode(event['Data'])
isCommand = False
if self.controlMode and not self.switchCtrlModeOnce == 1 or\ if self.controlMode and not self.switchCtrlModeOnce == 1 or\
not self.controlMode and self.switchCtrlModeOnce == 1: not self.controlMode and self.switchCtrlModeOnce == 1:
isCommand = self.detectByteCommand(event['Data']) isCommand = self.detectByteCommand(event['Data'])
if not isCommand: if not (isCommand or isControlMode):
self.environment['runtime']['screenManager'].injectTextToScreen(event['Data']) self.environment['runtime']['screenManager'].injectTextToScreen(event['Data'])
def handleControlMode(self, escapeSequence): def handleControlMode(self, escapeSequence):
convertedEscapeSequence = self.environment['runtime']['byteManager'].unifyEscapeSeq(escapeSequence) convertedEscapeSequence = self.environment['runtime']['byteManager'].unifyEscapeSeq(escapeSequence)
if self.switchCtrlModeOnce > 0:
self.switchCtrlModeOnce -= 1
if convertedEscapeSequence == b'^[R': if convertedEscapeSequence == b'^[R':
self.controlMode = not self.controlMode self.controlMode = not self.controlMode
self.switchCtrlModeOnce = 0 self.switchCtrlModeOnce = 0
@ -165,8 +173,7 @@ class fenrirManager():
def detectByteCommand(self, escapeSequence): def detectByteCommand(self, escapeSequence):
convertedEscapeSequence = self.environment['runtime']['byteManager'].unifyEscapeSeq(escapeSequence) convertedEscapeSequence = self.environment['runtime']['byteManager'].unifyEscapeSeq(escapeSequence)
if self.handleControlMode(convertedEscapeSequence):
return True
self.command = self.environment['runtime']['inputManager'].getCommandForShortcut(convertedEscapeSequence) self.command = self.environment['runtime']['inputManager'].getCommandForShortcut(convertedEscapeSequence)
self.environment['runtime']['eventManager'].putToEventQueue(fenrirEventType.ExecuteCommand, self.command) self.environment['runtime']['eventManager'].putToEventQueue(fenrirEventType.ExecuteCommand, self.command)
if self.command != '': if self.command != '':