ignore parameters, foldes, numeric, decimal and some more in spellcheck, replace strip == empty check with faster isspace
This commit is contained in:
parent
f6209f8b4c
commit
1c2d0caa56
@ -39,7 +39,7 @@ class command():
|
||||
else:
|
||||
x, y, marked = \
|
||||
line_utils.getCurrentLine(startMark['x'], startMark['y'], self.env['screenData']['newContentText'])
|
||||
if marked.strip(" \t\n") == '':
|
||||
if marked.isspace():
|
||||
self.env['runtime']['outputManager'].presentText("blank", soundIcon='EmptyLine', interrupt=True)
|
||||
else:
|
||||
self.env['runtime']['outputManager'].presentText(marked, interrupt=True)
|
||||
|
@ -39,7 +39,7 @@ class command():
|
||||
else:
|
||||
x, y, marked = \
|
||||
line_utils.getCurrentLine(startMark['x'], startMark['y'], self.env['screenData']['newContentText'])
|
||||
if marked.strip(" \t\n") == '':
|
||||
if marked.isspace():
|
||||
self.env['runtime']['outputManager'].presentText("blank", soundIcon='EmptyLine', interrupt=True)
|
||||
else:
|
||||
self.env['runtime']['outputManager'].presentText(marked, interrupt=True)
|
||||
|
@ -39,7 +39,7 @@ class command():
|
||||
else:
|
||||
x, y, marked = \
|
||||
line_utils.getCurrentLine(startMark['x'], startMark['y'], self.env['screenData']['newContentText'])
|
||||
if marked.strip(" \t\n") == '':
|
||||
if marked.isspace():
|
||||
self.env['runtime']['outputManager'].presentText("blank", soundIcon='EmptyLine', interrupt=True)
|
||||
else:
|
||||
self.env['runtime']['outputManager'].presentText(marked, interrupt=True)
|
||||
|
@ -39,7 +39,7 @@ class command():
|
||||
else:
|
||||
x, y, marked = \
|
||||
line_utils.getCurrentLine(startMark['x'], startMark['y'], self.env['screenData']['newContentText'])
|
||||
if marked.strip(" \t\n") == '':
|
||||
if marked.isspace():
|
||||
self.env['runtime']['outputManager'].presentText("blank", soundIcon='EmptyLine', interrupt=True)
|
||||
else:
|
||||
self.env['runtime']['outputManager'].presentText(marked, interrupt=True)
|
||||
|
@ -39,7 +39,7 @@ class command():
|
||||
else:
|
||||
x, y, marked = \
|
||||
line_utils.getCurrentLine(startMark['x'], startMark['y'], self.env['screenData']['newContentText'])
|
||||
if marked.strip(" \t\n") == '':
|
||||
if marked.isspace():
|
||||
self.env['runtime']['outputManager'].presentText("blank", soundIcon='EmptyLine', interrupt=True)
|
||||
else:
|
||||
self.env['runtime']['outputManager'].presentText(marked, interrupt=True)
|
||||
|
@ -39,7 +39,7 @@ class command():
|
||||
else:
|
||||
x, y, marked = \
|
||||
line_utils.getCurrentLine(startMark['x'], startMark['y'], self.env['screenData']['newContentText'])
|
||||
if marked.strip(" \t\n") == '':
|
||||
if marked.isspace():
|
||||
self.env['runtime']['outputManager'].presentText("blank", soundIcon='EmptyLine', interrupt=True)
|
||||
else:
|
||||
self.env['runtime']['outputManager'].presentText(marked, interrupt=True)
|
||||
|
@ -39,7 +39,7 @@ class command():
|
||||
else:
|
||||
x, y, marked = \
|
||||
line_utils.getCurrentLine(startMark['x'], startMark['y'], self.env['screenData']['newContentText'])
|
||||
if marked.strip(" \t\n") == '':
|
||||
if marked.isspace():
|
||||
self.env['runtime']['outputManager'].presentText("blank", soundIcon='EmptyLine', interrupt=True)
|
||||
else:
|
||||
self.env['runtime']['outputManager'].presentText(marked, interrupt=True)
|
||||
|
@ -39,7 +39,7 @@ class command():
|
||||
else:
|
||||
x, y, marked = \
|
||||
line_utils.getCurrentLine(startMark['x'], startMark['y'], self.env['screenData']['newContentText'])
|
||||
if marked.strip(" \t\n") == '':
|
||||
if marked.isspace():
|
||||
self.env['runtime']['outputManager'].presentText("blank", soundIcon='EmptyLine', interrupt=True)
|
||||
else:
|
||||
self.env['runtime']['outputManager'].presentText(marked, interrupt=True)
|
||||
|
@ -39,7 +39,7 @@ class command():
|
||||
else:
|
||||
x, y, marked = \
|
||||
line_utils.getCurrentLine(startMark['x'], startMark['y'], self.env['screenData']['newContentText'])
|
||||
if marked.strip(" \t\n") == '':
|
||||
if marked.isspace():
|
||||
self.env['runtime']['outputManager'].presentText("blank", soundIcon='EmptyLine', interrupt=True)
|
||||
else:
|
||||
self.env['runtime']['outputManager'].presentText(marked, interrupt=True)
|
||||
|
@ -39,7 +39,7 @@ class command():
|
||||
else:
|
||||
x, y, marked = \
|
||||
line_utils.getCurrentLine(startMark['x'], startMark['y'], self.env['screenData']['newContentText'])
|
||||
if marked.strip(" \t\n") == '':
|
||||
if marked.isspace():
|
||||
self.env['runtime']['outputManager'].presentText("blank", soundIcon='EmptyLine', interrupt=True)
|
||||
else:
|
||||
self.env['runtime']['outputManager'].presentText(marked, interrupt=True)
|
||||
|
@ -34,7 +34,7 @@ class command():
|
||||
self.env['commandBuffer']['Marks']['1'] = None
|
||||
self.env['commandBuffer']['Marks']['2'] = None
|
||||
|
||||
if marked.strip(" \t\n") == '':
|
||||
if marked.isspace():
|
||||
self.env['runtime']['outputManager'].presentText("blank", soundIcon='EmptyLine', interrupt=True)
|
||||
else:
|
||||
self.env['runtime']['outputManager'].presentText(marked, interrupt=True)
|
||||
|
@ -23,7 +23,7 @@ class command():
|
||||
x, y, currChar = \
|
||||
char_utils.getCurrentChar(cursorPos['x'], cursorPos['y'], self.env['screenData']['newContentText'])
|
||||
|
||||
if currChar.strip(" \t\n") == '':
|
||||
if currChar.isspace():
|
||||
self.env['runtime']['outputManager'].presentText("blank" ,interrupt=True)
|
||||
else:
|
||||
currChar = char_utils.getPhonetic(currChar)
|
||||
|
@ -17,7 +17,7 @@ class command():
|
||||
return 'reads the contents of the current screen'
|
||||
|
||||
def run(self):
|
||||
if self.env['screenData']['newContentText'].strip(" \t\n") == '':
|
||||
if self.env['screenData']['newContentText'].isspace():
|
||||
self.env['runtime']['outputManager'].presentText("screen is empty", soundIcon='EmptyLine', interrupt=True)
|
||||
else:
|
||||
self.env['runtime']['outputManager'].presentText(self.env['screenData']['newContentText'],interrupt=True)
|
||||
|
@ -23,7 +23,7 @@ class command():
|
||||
|
||||
textAfterCursor = mark_utils.getTextAfterMark(cursorPos, self.env['screenData']['newContentText'])
|
||||
|
||||
if textAfterCursor.strip(" \t\n") == '':
|
||||
if textAfterCursor.isspace():
|
||||
self.env['runtime']['outputManager'].presentText("blank", soundIcon='EmptyLine', interrupt=True)
|
||||
else:
|
||||
self.env['runtime']['outputManager'].presentText(textAfterCursor, interrupt=True)
|
||||
|
@ -26,7 +26,7 @@ class command():
|
||||
|
||||
textBeforeCursor = mark_utils.getTextBeforeMark(cursorPos, self.env['screenData']['newContentText'])
|
||||
|
||||
if textBeforeCursor.strip(" \t\n") == '':
|
||||
if textBeforeCursor.isspace():
|
||||
self.env['runtime']['outputManager'].presentText("blank", soundIcon='EmptyLine', interrupt=True)
|
||||
else:
|
||||
self.env['runtime']['outputManager'].presentText(textBeforeCursor, interrupt=True)
|
||||
|
@ -23,7 +23,7 @@ class command():
|
||||
x, y, currWord = \
|
||||
word_utils.getCurrentWord(cursorPos['x'], cursorPos['y'], self.env['screenData']['newContentText'])
|
||||
|
||||
if currWord.strip(" \t\n") == '':
|
||||
if currWord.isspace():
|
||||
self.env['runtime']['outputManager'].presentText("blank", interrupt=True)
|
||||
else:
|
||||
firstSequence = True
|
||||
|
@ -27,7 +27,7 @@ class command():
|
||||
x, y, currLine = \
|
||||
line_utils.getCurrentLine(cursorPos['x'], cursorPos['y'], self.env['screenData']['newContentText'])
|
||||
|
||||
if currLine.strip(" \t\n") == '':
|
||||
if currLine.isspace():
|
||||
self.env['runtime']['outputManager'].presentText("blank", soundIcon='EmptyLine', interrupt=True)
|
||||
else:
|
||||
self.env['runtime']['outputManager'].presentText("indent "+ str(len(currLine) - len(currLine.lstrip())), interrupt=True)
|
||||
|
@ -29,7 +29,7 @@ class command():
|
||||
|
||||
marked = mark_utils.getTextBetweenMarks(startMark, endMark, self.env['screenData']['newContentText'])
|
||||
|
||||
if marked.strip(" \t\n") == '':
|
||||
if marked.isspace():
|
||||
self.env['runtime']['outputManager'].presentText("blank", soundIcon='EmptyLine', interrupt=True)
|
||||
else:
|
||||
self.env['runtime']['outputManager'].presentText(marked, interrupt=True)
|
||||
|
@ -21,7 +21,7 @@ class command():
|
||||
x, y, firstLine = \
|
||||
line_utils.getCurrentLine(0, 0, self.env['screenData']['newContentText'])
|
||||
|
||||
if firstLine.strip(" \t\n") == '':
|
||||
if firstLine.isspace():
|
||||
self.env['runtime']['outputManager'].presentText("blank", soundIcon='EmptyLine', interrupt=True)
|
||||
else:
|
||||
self.env['runtime']['outputManager'].presentText(firstLine, interrupt=True)
|
||||
|
@ -21,7 +21,7 @@ class command():
|
||||
x, y, lastLine = \
|
||||
line_utils.getCurrentLine(0, self.env['screenData']['lines'] -1, self.env['screenData']['newContentText'])
|
||||
|
||||
if lastLine.strip(" \t\n") == '':
|
||||
if lastLine.isspace():
|
||||
self.env['runtime']['outputManager'].presentText("blank", soundIcon='EmptyLine', interrupt=True)
|
||||
else:
|
||||
self.env['runtime']['outputManager'].presentText(lastLine, interrupt=True)
|
||||
|
@ -44,7 +44,7 @@ class command():
|
||||
newContent = self.env['screenData']['newContentText'].split('\n')[cursorPos['y']]
|
||||
x, y, currWord = word_utils.getCurrentWord(cursorPos['x'], 0, newContent)
|
||||
|
||||
if currWord != '':
|
||||
if not currWord.isspace():
|
||||
if self.spellChecker.is_removed(currWord):
|
||||
self.env['runtime']['outputManager'].presentText(currWord + ' is already removed from dict',soundIcon='Cancel', interrupt=True)
|
||||
else:
|
||||
|
@ -23,7 +23,7 @@ class command():
|
||||
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], currChar = \
|
||||
char_utils.getCurrentChar(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText'])
|
||||
|
||||
if currChar.strip(" \t\n") == '':
|
||||
if currChar.isspace():
|
||||
self.env['runtime']['outputManager'].presentText("blank" ,interrupt=True)
|
||||
else:
|
||||
self.env['runtime']['outputManager'].presentText(currChar ,interrupt=True, ignorePunctuation=True, announceCapital=True)
|
||||
|
@ -23,7 +23,7 @@ class command():
|
||||
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], currLine = \
|
||||
line_utils.getCurrentLine(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText'])
|
||||
|
||||
if currLine.strip(" \t\n") == '':
|
||||
if currLine.isspace():
|
||||
self.env['runtime']['outputManager'].presentText("blank", soundIcon='EmptyLine', interrupt=True)
|
||||
else:
|
||||
self.env['runtime']['outputManager'].presentText(currLine, interrupt=True)
|
||||
|
@ -23,7 +23,7 @@ class command():
|
||||
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], currWord = \
|
||||
word_utils.getCurrentWord(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText'])
|
||||
|
||||
if currWord.strip(" \t\n") == '':
|
||||
if currWord.isspace():
|
||||
self.env['runtime']['outputManager'].presentText("blank", interrupt=True)
|
||||
else:
|
||||
self.env['runtime']['outputManager'].presentText(currWord, interrupt=True)
|
||||
|
@ -21,7 +21,7 @@ class command():
|
||||
cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor()
|
||||
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], downChar = \
|
||||
char_utils.getDownChar(self.env['screenData']['newCursorReview']['x'],self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText'])
|
||||
if downChar.strip(" \t\n") == '':
|
||||
if downChar.isspace():
|
||||
self.env['runtime']['outputManager'].presentText("line is empty" ,interrupt=True)
|
||||
else:
|
||||
self.env['runtime']['outputManager'].presentText(downChar ,interrupt=True, ignorePunctuation=True, announceCapital=True)
|
||||
|
@ -23,7 +23,7 @@ class command():
|
||||
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], currChar = \
|
||||
char_utils.getCurrentChar(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText'])
|
||||
|
||||
if currChar.strip(" \t\n") == '':
|
||||
if currChar.isspace():
|
||||
self.env['runtime']['outputManager'].presentText("blank" ,interrupt=True)
|
||||
else:
|
||||
self.env['runtime']['outputManager'].presentText(currChar ,interrupt=True, ignorePunctuation=True, announceCapital=True)
|
||||
|
@ -23,8 +23,8 @@ class command():
|
||||
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], currChar = \
|
||||
char_utils.getCurrentChar(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText'])
|
||||
|
||||
if currChar.strip(" \t\n") == '':
|
||||
self.env['runtime']['outputManager'].presentText("blank" ,interrupt=True)
|
||||
if currChar.isspace():
|
||||
self.env['runtime']['outputManager'].presentText("space" ,interrupt=True)
|
||||
else:
|
||||
self.env['runtime']['outputManager'].presentText(currChar ,interrupt=True, ignorePunctuation=True, announceCapital=True)
|
||||
self.env['runtime']['outputManager'].presentText("end of line", interrupt=False)
|
||||
|
@ -23,7 +23,7 @@ class command():
|
||||
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], lastChar = \
|
||||
char_utils.getLastCharInLine(self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText'])
|
||||
|
||||
if lastChar.strip(" \t\n") == '':
|
||||
if lastChar.isspace():
|
||||
self.env['runtime']['outputManager'].presentText("line is empty" ,interrupt=True)
|
||||
else:
|
||||
self.env['runtime']['outputManager'].presentText(lastChar ,interrupt=True, ignorePunctuation=True, announceCapital=True)
|
||||
|
@ -25,8 +25,8 @@ class command():
|
||||
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], currChar = \
|
||||
char_utils.getNextChar(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText'])
|
||||
|
||||
if currChar.strip(" \t\n") == '':
|
||||
self.env['runtime']['outputManager'].presentText("blank", interrupt=True)
|
||||
if currChar.isspace():
|
||||
self.env['runtime']['outputManager'].presentText("space", interrupt=True)
|
||||
else:
|
||||
self.env['runtime']['outputManager'].presentText(currChar, interrupt=True, ignorePunctuation=True, announceCapital=True)
|
||||
|
||||
|
@ -25,7 +25,7 @@ class command():
|
||||
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], currLine = \
|
||||
line_utils.getNextLine(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText'])
|
||||
|
||||
if currLine.strip(" \t\n") == '':
|
||||
if currLine.isspace():
|
||||
self.env['runtime']['outputManager'].presentText("blank", soundIcon='EmptyLine', interrupt=True)
|
||||
else:
|
||||
self.env['runtime']['outputManager'].presentText(currLine, interrupt=True)
|
||||
|
@ -25,7 +25,7 @@ class command():
|
||||
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], currWord = \
|
||||
word_utils.getNextWord(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText'])
|
||||
|
||||
if currWord.strip(" \t\n") == '':
|
||||
if currWord.isspace():
|
||||
self.env['runtime']['outputManager'].presentText("blank", interrupt=True)
|
||||
else:
|
||||
self.env['runtime']['outputManager'].presentText(currWord, interrupt=True)
|
||||
|
@ -25,8 +25,8 @@ class command():
|
||||
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], currChar = \
|
||||
char_utils.getPrevChar(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText'])
|
||||
|
||||
if currChar.strip(" \t\n") == '':
|
||||
self.env['runtime']['outputManager'].presentText("blank", interrupt=True)
|
||||
if currChar.isspace():
|
||||
self.env['runtime']['outputManager'].presentText("space", interrupt=True)
|
||||
else:
|
||||
self.env['runtime']['outputManager'].presentText(currChar, interrupt=True, ignorePunctuation=True, announceCapital=True)
|
||||
|
||||
|
@ -23,7 +23,7 @@ class command():
|
||||
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], currLine = \
|
||||
line_utils.getPrevLine(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText'])
|
||||
|
||||
if currLine.strip(" \t\n") == '':
|
||||
if currLine.isspace():
|
||||
self.env['runtime']['outputManager'].presentText("blank", soundIcon='EmptyLine', interrupt=True)
|
||||
else:
|
||||
self.env['runtime']['outputManager'].presentText(currLine, interrupt=True)
|
||||
|
@ -23,7 +23,7 @@ class command():
|
||||
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], currWord = \
|
||||
word_utils.getPrevWord(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText'])
|
||||
|
||||
if currWord.strip(" \t\n") == '':
|
||||
if currWord.isspace()':
|
||||
self.env['runtime']['outputManager'].presentText("blank", interrupt=True)
|
||||
else:
|
||||
self.env['runtime']['outputManager'].presentText(currWord, interrupt=True)
|
||||
|
@ -21,7 +21,7 @@ class command():
|
||||
cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor()
|
||||
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], upChar = \
|
||||
char_utils.getUpChar(self.env['screenData']['newCursorReview']['x'],self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText'])
|
||||
if upChar.strip(" \t\n") == '':
|
||||
if upChar.isspace():
|
||||
self.env['runtime']['outputManager'].presentText("line is empty" ,interrupt=True)
|
||||
else:
|
||||
self.env['runtime']['outputManager'].presentText(upChar ,interrupt=True, ignorePunctuation=True, announceCapital=True)
|
||||
|
@ -44,9 +44,10 @@ class command():
|
||||
newContent = self.env['screenData']['newContentText'].split('\n')[cursorPos['y']]
|
||||
x, y, currWord = word_utils.getCurrentWord(cursorPos['x'], 0, newContent)
|
||||
|
||||
if currWord != '':
|
||||
if not currWord.isspace():
|
||||
if not self.spellChecker.check(currWord):
|
||||
self.env['runtime']['outputManager'].presentText('misspelled',soundIcon='mispell', interrupt=True)
|
||||
|
||||
elif not ignore:
|
||||
self.env['runtime']['outputManager'].presentText('correct',soundIcon='', interrupt=True)
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -31,7 +31,7 @@ class command():
|
||||
self.env['screenData']['newCursor']['x'] == self.env['screenData']['oldCursor']['x']:
|
||||
return
|
||||
currChar = self.env['screenData']['newContentText'].split('\n')[self.env['screenData']['newCursor']['y']][self.env['screenData']['newCursor']['x']]
|
||||
if not currChar.strip(" \t\n") == '':
|
||||
if not currChar.isspace():
|
||||
self.env['runtime']['outputManager'].presentText(currChar, interrupt=True, ignorePunctuation=True, announceCapital=True)
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -28,7 +28,7 @@ class command():
|
||||
if self.env['runtime']['inputManager'].noKeyPressed():
|
||||
return
|
||||
currLine = self.env['screenData']['newContentText'].split('\n')[self.env['screenData']['newCursor']['y']]
|
||||
if currLine.strip(" \t\n") == '':
|
||||
if currLine.isspace():
|
||||
self.env['runtime']['outputManager'].presentText("blank", soundIcon='EmptyLine', interrupt=True)
|
||||
else:
|
||||
self.env['runtime']['outputManager'].presentText(currLine, interrupt=True)
|
||||
|
@ -69,7 +69,24 @@ class command():
|
||||
if not(newContent[self.env['screenData']['newCursor']['x']].strip(" \t\n") == '' and x != self.env['screenData']['newCursor']['x']):
|
||||
return
|
||||
|
||||
if currWord != '':
|
||||
if currWord == '':
|
||||
return
|
||||
if currWord.startswith('-'):
|
||||
return
|
||||
if currWord.startswith('/'):
|
||||
return
|
||||
if currWord.startswith('#'):
|
||||
return
|
||||
if currWord.startswith('./'):
|
||||
return
|
||||
if currWord.startswith('@'):
|
||||
return
|
||||
if currWord.isnumeric():
|
||||
return
|
||||
if currWord.isdecimal():
|
||||
return
|
||||
if currWord.isspace():
|
||||
return
|
||||
if not self.spellChecker.check(currWord):
|
||||
self.env['runtime']['outputManager'].presentText('misspelled',soundIcon='mispell', interrupt=False)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user