strip whitespace
This commit is contained in:
parent
d6498f053c
commit
13742ba980
@ -36,7 +36,6 @@ class command():
|
|||||||
# is there any change?
|
# is there any change?
|
||||||
if not self.env['runtime']['screenManager'].isDelta():
|
if not self.env['runtime']['screenManager'].isDelta():
|
||||||
return
|
return
|
||||||
|
|
||||||
# filter unneded space on word begin
|
# filter unneded space on word begin
|
||||||
currDelta = self.env['screen']['newDelta']
|
currDelta = self.env['screen']['newDelta']
|
||||||
if len(currDelta.strip()) != len(currDelta) and \
|
if len(currDelta.strip()) != len(currDelta) and \
|
||||||
|
@ -15,7 +15,6 @@ class command():
|
|||||||
pass
|
pass
|
||||||
def getDescription(self):
|
def getDescription(self):
|
||||||
return 'No Description found'
|
return 'No Description found'
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
# try to detect the tab completion by cursor change
|
# try to detect the tab completion by cursor change
|
||||||
xMove = self.env['screen']['newCursor']['x'] - self.env['screen']['oldCursor']['x']
|
xMove = self.env['screen']['newCursor']['x'] - self.env['screen']['oldCursor']['x']
|
||||||
@ -32,7 +31,6 @@ class command():
|
|||||||
return
|
return
|
||||||
if not xMove == len(self.env['screen']['newDelta']):
|
if not xMove == len(self.env['screen']['newDelta']):
|
||||||
return
|
return
|
||||||
|
|
||||||
# filter unneded space on word begin
|
# filter unneded space on word begin
|
||||||
currDelta = self.env['screen']['newDelta']
|
currDelta = self.env['screen']['newDelta']
|
||||||
if len(currDelta.strip()) != len(currDelta) and \
|
if len(currDelta.strip()) != len(currDelta) and \
|
||||||
|
@ -13,13 +13,11 @@ class command():
|
|||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
pass
|
pass
|
||||||
def getDescription(self):
|
def getDescription(self):
|
||||||
return _('enables or disables tracking of highlighted')
|
return _('enables or disables tracking of highlighted')
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
if not self.env['runtime']['settingsManager'].getSettingAsBool('focus', 'highlight'):
|
if not self.env['runtime']['settingsManager'].getSettingAsBool('focus', 'highlight'):
|
||||||
return
|
return
|
||||||
attributeDelta = self.env['runtime']['attributeManager'].getAttributeDelta()
|
attributeDelta = self.env['runtime']['attributeManager'].getAttributeDelta()
|
||||||
self.env['runtime']['outputManager'].presentText(attributeDelta, soundIcon='', interrupt=True, flush=False)
|
self.env['runtime']['outputManager'].presentText(attributeDelta, soundIcon='', interrupt=True, flush=False)
|
||||||
|
|
||||||
def setCallback(self, callback):
|
def setCallback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -14,7 +14,7 @@ class command():
|
|||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
pass
|
pass
|
||||||
def getDescription(self):
|
def getDescription(self):
|
||||||
return ''
|
return ''
|
||||||
def run(self):
|
def run(self):
|
||||||
if self.env['screen']['newAttribDelta'] != '':
|
if self.env['screen']['newAttribDelta'] != '':
|
||||||
return
|
return
|
||||||
@ -31,15 +31,15 @@ class command():
|
|||||||
if self.env['runtime']['inputManager'].getShortcutType() in ['KEY']:
|
if self.env['runtime']['inputManager'].getShortcutType() in ['KEY']:
|
||||||
if not (self.env['runtime']['inputManager'].getLastDeepestInput() in [['KEY_UP'],['KEY_DOWN']]):
|
if not (self.env['runtime']['inputManager'].getLastDeepestInput() in [['KEY_UP'],['KEY_DOWN']]):
|
||||||
return
|
return
|
||||||
if self.env['runtime']['inputManager'].getShortcutType() in ['BYTE']:
|
elif self.env['runtime']['inputManager'].getShortcutType() in ['BYTE']:
|
||||||
if not (self.env['runtime']['byteManager'].getLastByteKey() in [b'^[[A',b'^[[B']):
|
if not (self.env['runtime']['byteManager'].getLastByteKey() in [b'^[[A',b'^[[B']):
|
||||||
return
|
return
|
||||||
|
|
||||||
prevLine = self.env['screen']['oldContentText'].split('\n')[self.env['screen']['newCursor']['y']]
|
prevLine = self.env['screen']['oldContentText'].split('\n')[self.env['screen']['newCursor']['y']]
|
||||||
currLine = self.env['screen']['newContentText'].split('\n')[self.env['screen']['newCursor']['y']]
|
currLine = self.env['screen']['newContentText'].split('\n')[self.env['screen']['newCursor']['y']]
|
||||||
if prevLine == currLine:
|
if prevLine == currLine:
|
||||||
if self.env['screen']['newDelta'] != '':
|
if self.env['screen']['newDelta'] != '':
|
||||||
return
|
return
|
||||||
if not currLine.isspace():
|
if not currLine.isspace():
|
||||||
currPrompt = currLine.find('$')
|
currPrompt = currLine.find('$')
|
||||||
rootPrompt = currLine.find('#')
|
rootPrompt = currLine.find('#')
|
||||||
@ -47,17 +47,17 @@ class command():
|
|||||||
if rootPrompt > 0:
|
if rootPrompt > 0:
|
||||||
currPrompt = rootPrompt
|
currPrompt = rootPrompt
|
||||||
else:
|
else:
|
||||||
announce = currLine
|
announce = currLine
|
||||||
if currPrompt > 0:
|
if currPrompt > 0:
|
||||||
remove_digits = str.maketrans('0123456789', ' ')
|
remove_digits = str.maketrans('0123456789', ' ')
|
||||||
if prevLine[:currPrompt].translate(remove_digits) == currLine[:currPrompt].translate(remove_digits):
|
if prevLine[:currPrompt].translate(remove_digits) == currLine[:currPrompt].translate(remove_digits):
|
||||||
announce = currLine[currPrompt+1:]
|
announce = currLine[currPrompt+1:]
|
||||||
else:
|
else:
|
||||||
announce = currLine
|
announce = currLine
|
||||||
|
|
||||||
if currLine.isspace():
|
if currLine.isspace():
|
||||||
self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True, flush=False)
|
self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True, flush=False)
|
||||||
else:
|
else:
|
||||||
self.env['runtime']['outputManager'].presentText(announce, interrupt=True, flush=False)
|
self.env['runtime']['outputManager'].presentText(announce, interrupt=True, flush=False)
|
||||||
self.env['commandsIgnore']['onScreenUpdate']['CHAR_DELETE_ECHO'] = True
|
self.env['commandsIgnore']['onScreenUpdate']['CHAR_DELETE_ECHO'] = True
|
||||||
self.env['commandsIgnore']['onScreenUpdate']['CHAR_ECHO'] = True
|
self.env['commandsIgnore']['onScreenUpdate']['CHAR_ECHO'] = True
|
||||||
|
@ -21,9 +21,9 @@ class command():
|
|||||||
return
|
return
|
||||||
# is there something to read?
|
# is there something to read?
|
||||||
if not self.env['runtime']['screenManager'].isDelta(ignoreSpace=True):
|
if not self.env['runtime']['screenManager'].isDelta(ignoreSpace=True):
|
||||||
return
|
return
|
||||||
|
|
||||||
# this must be a keyecho or something
|
# this must be a keyecho or something
|
||||||
#if len(self.env['screen']['newDelta'].strip(' \n\t')) <= 1:
|
#if len(self.env['screen']['newDelta'].strip(' \n\t')) <= 1:
|
||||||
xMove = abs(self.env['screen']['newCursor']['x'] - self.env['screen']['oldCursor']['x'])
|
xMove = abs(self.env['screen']['newCursor']['x'] - self.env['screen']['oldCursor']['x'])
|
||||||
yMove = abs(self.env['screen']['newCursor']['y'] - self.env['screen']['oldCursor']['y'])
|
yMove = abs(self.env['screen']['newCursor']['y'] - self.env['screen']['oldCursor']['y'])
|
||||||
|
@ -15,8 +15,7 @@ class command():
|
|||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
pass
|
pass
|
||||||
def getDescription(self):
|
def getDescription(self):
|
||||||
return 'No Description found'
|
return 'No Description found'
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
if not self.env['runtime']['settingsManager'].getSettingAsBool('promote', 'enabled'):
|
if not self.env['runtime']['settingsManager'].getSettingAsBool('promote', 'enabled'):
|
||||||
return
|
return
|
||||||
@ -25,13 +24,12 @@ class command():
|
|||||||
if int(time.time() - self.env['input']['lastInputTime']) < self.env['runtime']['settingsManager'].getSettingAsInt('promote', 'inactiveTimeoutSec'):
|
if int(time.time() - self.env['input']['lastInputTime']) < self.env['runtime']['settingsManager'].getSettingAsInt('promote', 'inactiveTimeoutSec'):
|
||||||
return
|
return
|
||||||
if len(self.env['runtime']['settingsManager'].getSetting('promote', 'list')) == 0:
|
if len(self.env['runtime']['settingsManager'].getSetting('promote', 'list')) == 0:
|
||||||
return
|
return
|
||||||
for promote in self.env['runtime']['settingsManager'].getSetting('promote', 'list').split(','):
|
for promote in self.env['runtime']['settingsManager'].getSetting('promote', 'list').split(','):
|
||||||
if promote in self.env['screen']['newDelta']:
|
if promote in self.env['screen']['newDelta']:
|
||||||
self.env['runtime']['outputManager'].playSoundIcon('PromotedText')
|
self.env['runtime']['outputManager'].playSoundIcon('PromotedText')
|
||||||
self.env['input']['lastInputTime'] = time.time()
|
self.env['input']['lastInputTime'] = time.time()
|
||||||
return
|
return
|
||||||
|
|
||||||
def setCallback(self, callback):
|
def setCallback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -14,16 +14,13 @@ class command():
|
|||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
pass
|
pass
|
||||||
def getDescription(self):
|
def getDescription(self):
|
||||||
return 'No Description found'
|
return 'No Description found'
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
if not self.env['runtime']['settingsManager'].getSettingAsBool('barrier','enabled'):
|
if not self.env['runtime']['settingsManager'].getSettingAsBool('barrier','enabled'):
|
||||||
return
|
return
|
||||||
if not self.env['runtime']['screenManager'].isDelta(ignoreSpace=True):
|
if not self.env['runtime']['screenManager'].isDelta(ignoreSpace=True):
|
||||||
return
|
return
|
||||||
|
|
||||||
self.env['runtime']['barrierManager'].handleLineBarrier(self.env['screen']['newContentText'].split('\n'), self.env['screen']['newCursor']['x'],self.env['screen']['newCursor']['y'])
|
self.env['runtime']['barrierManager'].handleLineBarrier(self.env['screen']['newContentText'].split('\n'), self.env['screen']['newCursor']['x'],self.env['screen']['newCursor']['y'])
|
||||||
|
|
||||||
def setCallback(self, callback):
|
def setCallback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user