strip whitespace

This commit is contained in:
Chrys 2019-09-06 22:16:00 +02:00
parent d6498f053c
commit 13742ba980
7 changed files with 18 additions and 28 deletions

View File

@ -36,7 +36,6 @@ class command():
# is there any change?
if not self.env['runtime']['screenManager'].isDelta():
return
# filter unneded space on word begin
currDelta = self.env['screen']['newDelta']
if len(currDelta.strip()) != len(currDelta) and \

View File

@ -15,7 +15,6 @@ class command():
pass
def getDescription(self):
return 'No Description found'
def run(self):
# try to detect the tab completion by cursor change
xMove = self.env['screen']['newCursor']['x'] - self.env['screen']['oldCursor']['x']
@ -32,7 +31,6 @@ class command():
return
if not xMove == len(self.env['screen']['newDelta']):
return
# filter unneded space on word begin
currDelta = self.env['screen']['newDelta']
if len(currDelta.strip()) != len(currDelta) and \

View File

@ -13,13 +13,11 @@ class command():
def shutdown(self):
pass
def getDescription(self):
return _('enables or disables tracking of highlighted')
return _('enables or disables tracking of highlighted')
def run(self):
if not self.env['runtime']['settingsManager'].getSettingAsBool('focus', 'highlight'):
return
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):
pass

View File

@ -14,7 +14,7 @@ class command():
def shutdown(self):
pass
def getDescription(self):
return ''
return ''
def run(self):
if self.env['screen']['newAttribDelta'] != '':
return
@ -31,15 +31,15 @@ class command():
if self.env['runtime']['inputManager'].getShortcutType() in ['KEY']:
if not (self.env['runtime']['inputManager'].getLastDeepestInput() in [['KEY_UP'],['KEY_DOWN']]):
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']):
return
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 self.env['screen']['newDelta'] != '':
return
return
if not currLine.isspace():
currPrompt = currLine.find('$')
rootPrompt = currLine.find('#')
@ -47,17 +47,17 @@ class command():
if rootPrompt > 0:
currPrompt = rootPrompt
else:
announce = currLine
announce = currLine
if currPrompt > 0:
remove_digits = str.maketrans('0123456789', ' ')
if prevLine[:currPrompt].translate(remove_digits) == currLine[:currPrompt].translate(remove_digits):
announce = currLine[currPrompt+1:]
else:
announce = currLine
announce = currLine
if currLine.isspace():
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['commandsIgnore']['onScreenUpdate']['CHAR_DELETE_ECHO'] = True
self.env['commandsIgnore']['onScreenUpdate']['CHAR_ECHO'] = True

View File

@ -21,9 +21,9 @@ class command():
return
# is there something to read?
if not self.env['runtime']['screenManager'].isDelta(ignoreSpace=True):
return
# this must be a keyecho or something
return
# this must be a keyecho or something
#if len(self.env['screen']['newDelta'].strip(' \n\t')) <= 1:
xMove = abs(self.env['screen']['newCursor']['x'] - self.env['screen']['oldCursor']['x'])
yMove = abs(self.env['screen']['newCursor']['y'] - self.env['screen']['oldCursor']['y'])

View File

@ -15,8 +15,7 @@ class command():
def shutdown(self):
pass
def getDescription(self):
return 'No Description found'
return 'No Description found'
def run(self):
if not self.env['runtime']['settingsManager'].getSettingAsBool('promote', 'enabled'):
return
@ -25,13 +24,12 @@ class command():
if int(time.time() - self.env['input']['lastInputTime']) < self.env['runtime']['settingsManager'].getSettingAsInt('promote', 'inactiveTimeoutSec'):
return
if len(self.env['runtime']['settingsManager'].getSetting('promote', 'list')) == 0:
return
return
for promote in self.env['runtime']['settingsManager'].getSetting('promote', 'list').split(','):
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()
return
def setCallback(self, callback):
pass

View File

@ -14,16 +14,13 @@ class command():
def shutdown(self):
pass
def getDescription(self):
return 'No Description found'
return 'No Description found'
def run(self):
if not self.env['runtime']['settingsManager'].getSettingAsBool('barrier','enabled'):
return
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'])
def setCallback(self, callback):
pass