2016-08-07 17:00:54 +02:00
|
|
|
#!/bin/python
|
|
|
|
|
|
|
|
class command():
|
|
|
|
def __init__(self):
|
|
|
|
pass
|
2016-09-02 21:37:36 +02:00
|
|
|
def initialize(self, environment):
|
|
|
|
return environment
|
|
|
|
def shutdown(self, environment):
|
|
|
|
return environment
|
2016-09-17 02:14:11 +02:00
|
|
|
def getDescription(self, environment):
|
2016-09-02 21:37:36 +02:00
|
|
|
return ''
|
2016-09-17 02:14:11 +02:00
|
|
|
|
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
|
2016-09-02 21:37:36 +02:00
|
|
|
|