fenrir/src/fenrir-package/commands/onScreenChanged/65000-char_delete_echo.py

41 lines
1.5 KiB
Python
Raw Normal View History

2016-08-07 17:00:54 +02:00
#!/bin/python
class command():
def __init__(self):
pass
def initialize(self, environment):
return environment
def shutdown(self, environment):
return environment
def getDescription(self):
return ''
2016-08-07 17:00:54 +02:00
def run(self, environment):
if not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'keyboard', 'charDeleteEcho'):
return environment
# detect typing or chilling
if environment['screenData']['newCursor']['x'] >= environment['screenData']['oldCursor']['x']:
return environment
# TTY change
if environment['screenData']['newTTY'] != environment['screenData']['oldTTY']:
return environment
# More than just a deletion happend
2016-08-28 17:21:05 +02:00
if environment['screenData']['newDelta'].strip() != '':
2016-08-07 17:00:54 +02:00
if environment['screenData']['newDelta'] != environment['screenData']['oldDelta']:
return environment
# No deletion
if environment['screenData']['newNegativeDelta'] == '':
return environment
2016-09-02 23:20:27 +02:00
# too much for a single backspace...
if len(environment['screenData']['newNegativeDelta']) >= 5:
return environment
2016-08-07 17:00:54 +02:00
environment['runtime']['outputManager'].presentText(environment, environment['screenData']['newNegativeDelta'], interrupt=True)
return environment
def setCallback(self, callback):
pass