diff --git a/src/fenrir-package/commands/commands/bookmark_1.py b/src/fenrir-package/commands/commands/bookmark_1.py index 0ecd7285..af89911d 100644 --- a/src/fenrir-package/commands/commands/bookmark_1.py +++ b/src/fenrir-package/commands/commands/bookmark_1.py @@ -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) diff --git a/src/fenrir-package/commands/commands/bookmark_10.py b/src/fenrir-package/commands/commands/bookmark_10.py index 78458d15..9df8c53a 100644 --- a/src/fenrir-package/commands/commands/bookmark_10.py +++ b/src/fenrir-package/commands/commands/bookmark_10.py @@ -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) diff --git a/src/fenrir-package/commands/commands/bookmark_2.py b/src/fenrir-package/commands/commands/bookmark_2.py index c104fbab..13bf67cd 100644 --- a/src/fenrir-package/commands/commands/bookmark_2.py +++ b/src/fenrir-package/commands/commands/bookmark_2.py @@ -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) diff --git a/src/fenrir-package/commands/commands/bookmark_3.py b/src/fenrir-package/commands/commands/bookmark_3.py index 8ac7d219..72a9e69f 100644 --- a/src/fenrir-package/commands/commands/bookmark_3.py +++ b/src/fenrir-package/commands/commands/bookmark_3.py @@ -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) diff --git a/src/fenrir-package/commands/commands/bookmark_4.py b/src/fenrir-package/commands/commands/bookmark_4.py index 632078a1..dd7c79e9 100644 --- a/src/fenrir-package/commands/commands/bookmark_4.py +++ b/src/fenrir-package/commands/commands/bookmark_4.py @@ -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) diff --git a/src/fenrir-package/commands/commands/bookmark_5.py b/src/fenrir-package/commands/commands/bookmark_5.py index a6f0dbb4..7fb1a8b4 100644 --- a/src/fenrir-package/commands/commands/bookmark_5.py +++ b/src/fenrir-package/commands/commands/bookmark_5.py @@ -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) diff --git a/src/fenrir-package/commands/commands/bookmark_6.py b/src/fenrir-package/commands/commands/bookmark_6.py index b3af4f1d..2faa84be 100644 --- a/src/fenrir-package/commands/commands/bookmark_6.py +++ b/src/fenrir-package/commands/commands/bookmark_6.py @@ -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) diff --git a/src/fenrir-package/commands/commands/bookmark_7.py b/src/fenrir-package/commands/commands/bookmark_7.py index ead50f79..cb7880ff 100644 --- a/src/fenrir-package/commands/commands/bookmark_7.py +++ b/src/fenrir-package/commands/commands/bookmark_7.py @@ -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) diff --git a/src/fenrir-package/commands/commands/bookmark_8.py b/src/fenrir-package/commands/commands/bookmark_8.py index 0e3546d1..1439dea6 100644 --- a/src/fenrir-package/commands/commands/bookmark_8.py +++ b/src/fenrir-package/commands/commands/bookmark_8.py @@ -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) diff --git a/src/fenrir-package/commands/commands/bookmark_9.py b/src/fenrir-package/commands/commands/bookmark_9.py index 41f70c84..a494a7a4 100644 --- a/src/fenrir-package/commands/commands/bookmark_9.py +++ b/src/fenrir-package/commands/commands/bookmark_9.py @@ -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) diff --git a/src/fenrir-package/commands/commands/copy_marked_to_clipboard.py b/src/fenrir-package/commands/commands/copy_marked_to_clipboard.py index edafe95c..730082fc 100644 --- a/src/fenrir-package/commands/commands/copy_marked_to_clipboard.py +++ b/src/fenrir-package/commands/commands/copy_marked_to_clipboard.py @@ -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) diff --git a/src/fenrir-package/commands/commands/curr_char_phonetic.py b/src/fenrir-package/commands/commands/curr_char_phonetic.py index eccb321d..8408b41e 100644 --- a/src/fenrir-package/commands/commands/curr_char_phonetic.py +++ b/src/fenrir-package/commands/commands/curr_char_phonetic.py @@ -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) diff --git a/src/fenrir-package/commands/commands/curr_screen.py b/src/fenrir-package/commands/commands/curr_screen.py index 48e24231..8a1d42b0 100644 --- a/src/fenrir-package/commands/commands/curr_screen.py +++ b/src/fenrir-package/commands/commands/curr_screen.py @@ -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) diff --git a/src/fenrir-package/commands/commands/curr_screen_after_cursor.py b/src/fenrir-package/commands/commands/curr_screen_after_cursor.py index d78110fa..7b33dff7 100644 --- a/src/fenrir-package/commands/commands/curr_screen_after_cursor.py +++ b/src/fenrir-package/commands/commands/curr_screen_after_cursor.py @@ -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) diff --git a/src/fenrir-package/commands/commands/curr_screen_before_cursor.py b/src/fenrir-package/commands/commands/curr_screen_before_cursor.py index 34a0a3fc..e9367411 100644 --- a/src/fenrir-package/commands/commands/curr_screen_before_cursor.py +++ b/src/fenrir-package/commands/commands/curr_screen_before_cursor.py @@ -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) diff --git a/src/fenrir-package/commands/commands/curr_word_phonetic.py b/src/fenrir-package/commands/commands/curr_word_phonetic.py index 24d5c4b8..737e70c5 100644 --- a/src/fenrir-package/commands/commands/curr_word_phonetic.py +++ b/src/fenrir-package/commands/commands/curr_word_phonetic.py @@ -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 diff --git a/src/fenrir-package/commands/commands/indent_curr_line.py b/src/fenrir-package/commands/commands/indent_curr_line.py index a06d34ff..4cfe3bdf 100644 --- a/src/fenrir-package/commands/commands/indent_curr_line.py +++ b/src/fenrir-package/commands/commands/indent_curr_line.py @@ -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) diff --git a/src/fenrir-package/commands/commands/marked_text.py b/src/fenrir-package/commands/commands/marked_text.py index 1125653a..7e7bc323 100644 --- a/src/fenrir-package/commands/commands/marked_text.py +++ b/src/fenrir-package/commands/commands/marked_text.py @@ -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) diff --git a/src/fenrir-package/commands/commands/present_first_line.py b/src/fenrir-package/commands/commands/present_first_line.py index efa4b620..40954173 100644 --- a/src/fenrir-package/commands/commands/present_first_line.py +++ b/src/fenrir-package/commands/commands/present_first_line.py @@ -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) diff --git a/src/fenrir-package/commands/commands/present_last_line.py b/src/fenrir-package/commands/commands/present_last_line.py index 65af8220..f53af172 100644 --- a/src/fenrir-package/commands/commands/present_last_line.py +++ b/src/fenrir-package/commands/commands/present_last_line.py @@ -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) diff --git a/src/fenrir-package/commands/commands/remove_word_from_spell_check.py b/src/fenrir-package/commands/commands/remove_word_from_spell_check.py index 45507d26..6758ef26 100644 --- a/src/fenrir-package/commands/commands/remove_word_from_spell_check.py +++ b/src/fenrir-package/commands/commands/remove_word_from_spell_check.py @@ -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: diff --git a/src/fenrir-package/commands/commands/review_curr_char.py b/src/fenrir-package/commands/commands/review_curr_char.py index d89622f8..993f5929 100644 --- a/src/fenrir-package/commands/commands/review_curr_char.py +++ b/src/fenrir-package/commands/commands/review_curr_char.py @@ -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) diff --git a/src/fenrir-package/commands/commands/review_curr_line.py b/src/fenrir-package/commands/commands/review_curr_line.py index 21dc9d28..6d8c9c19 100644 --- a/src/fenrir-package/commands/commands/review_curr_line.py +++ b/src/fenrir-package/commands/commands/review_curr_line.py @@ -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) diff --git a/src/fenrir-package/commands/commands/review_curr_word.py b/src/fenrir-package/commands/commands/review_curr_word.py index a39e097d..0d657a6b 100644 --- a/src/fenrir-package/commands/commands/review_curr_word.py +++ b/src/fenrir-package/commands/commands/review_curr_word.py @@ -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) diff --git a/src/fenrir-package/commands/commands/review_down.py b/src/fenrir-package/commands/commands/review_down.py index 25843872..bea47c06 100644 --- a/src/fenrir-package/commands/commands/review_down.py +++ b/src/fenrir-package/commands/commands/review_down.py @@ -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) diff --git a/src/fenrir-package/commands/commands/review_line_begin.py b/src/fenrir-package/commands/commands/review_line_begin.py index 61e17e46..e69c0a37 100644 --- a/src/fenrir-package/commands/commands/review_line_begin.py +++ b/src/fenrir-package/commands/commands/review_line_begin.py @@ -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) diff --git a/src/fenrir-package/commands/commands/review_line_end.py b/src/fenrir-package/commands/commands/review_line_end.py index ad7cb18f..9bb30561 100644 --- a/src/fenrir-package/commands/commands/review_line_end.py +++ b/src/fenrir-package/commands/commands/review_line_end.py @@ -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) diff --git a/src/fenrir-package/commands/commands/review_line_last_char.py b/src/fenrir-package/commands/commands/review_line_last_char.py index 6a494543..bb405abd 100644 --- a/src/fenrir-package/commands/commands/review_line_last_char.py +++ b/src/fenrir-package/commands/commands/review_line_last_char.py @@ -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) diff --git a/src/fenrir-package/commands/commands/review_next_char.py b/src/fenrir-package/commands/commands/review_next_char.py index a35c4008..aa74a972 100644 --- a/src/fenrir-package/commands/commands/review_next_char.py +++ b/src/fenrir-package/commands/commands/review_next_char.py @@ -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) diff --git a/src/fenrir-package/commands/commands/review_next_line.py b/src/fenrir-package/commands/commands/review_next_line.py index df0a0aec..94966046 100644 --- a/src/fenrir-package/commands/commands/review_next_line.py +++ b/src/fenrir-package/commands/commands/review_next_line.py @@ -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) diff --git a/src/fenrir-package/commands/commands/review_next_word.py b/src/fenrir-package/commands/commands/review_next_word.py index ace9490f..c41c6f5d 100644 --- a/src/fenrir-package/commands/commands/review_next_word.py +++ b/src/fenrir-package/commands/commands/review_next_word.py @@ -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) diff --git a/src/fenrir-package/commands/commands/review_prev_char.py b/src/fenrir-package/commands/commands/review_prev_char.py index 4f5c704b..6cfb8705 100644 --- a/src/fenrir-package/commands/commands/review_prev_char.py +++ b/src/fenrir-package/commands/commands/review_prev_char.py @@ -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) diff --git a/src/fenrir-package/commands/commands/review_prev_line.py b/src/fenrir-package/commands/commands/review_prev_line.py index 746ce5d4..16d1f135 100644 --- a/src/fenrir-package/commands/commands/review_prev_line.py +++ b/src/fenrir-package/commands/commands/review_prev_line.py @@ -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) diff --git a/src/fenrir-package/commands/commands/review_prev_word.py b/src/fenrir-package/commands/commands/review_prev_word.py index 683da62b..5052723f 100644 --- a/src/fenrir-package/commands/commands/review_prev_word.py +++ b/src/fenrir-package/commands/commands/review_prev_word.py @@ -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) diff --git a/src/fenrir-package/commands/commands/review_up.py b/src/fenrir-package/commands/commands/review_up.py index 129ab8b9..9637f9e2 100644 --- a/src/fenrir-package/commands/commands/review_up.py +++ b/src/fenrir-package/commands/commands/review_up.py @@ -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) diff --git a/src/fenrir-package/commands/commands/spell_check.py b/src/fenrir-package/commands/commands/spell_check.py index 2ce82f01..363b8624 100644 --- a/src/fenrir-package/commands/commands/spell_check.py +++ b/src/fenrir-package/commands/commands/spell_check.py @@ -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 diff --git a/src/fenrir-package/commands/onInput/45000-present_char_if_cursor_change_horizontal.py b/src/fenrir-package/commands/onInput/45000-present_char_if_cursor_change_horizontal.py index a1920e8c..bb7bc291 100644 --- a/src/fenrir-package/commands/onInput/45000-present_char_if_cursor_change_horizontal.py +++ b/src/fenrir-package/commands/onInput/45000-present_char_if_cursor_change_horizontal.py @@ -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 diff --git a/src/fenrir-package/commands/onInput/55000-present_line_if_cursor_change_vertical.py b/src/fenrir-package/commands/onInput/55000-present_line_if_cursor_change_vertical.py index acda3aa3..da0800f7 100644 --- a/src/fenrir-package/commands/onInput/55000-present_line_if_cursor_change_vertical.py +++ b/src/fenrir-package/commands/onInput/55000-present_line_if_cursor_change_vertical.py @@ -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) diff --git a/src/fenrir-package/commands/onInput/62000-spell_check.py b/src/fenrir-package/commands/onInput/62000-spell_check.py index f3c9aa81..19687ce8 100644 --- a/src/fenrir-package/commands/onInput/62000-spell_check.py +++ b/src/fenrir-package/commands/onInput/62000-spell_check.py @@ -69,9 +69,26 @@ class command(): if not(newContent[self.env['screenData']['newCursor']['x']].strip(" \t\n") == '' and x != self.env['screenData']['newCursor']['x']): return - if currWord != '': - if not self.spellChecker.check(currWord): - self.env['runtime']['outputManager'].presentText('misspelled',soundIcon='mispell', interrupt=False) + 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) def setCallback(self, callback): pass