port onInput to new return values
This commit is contained in:
@@ -17,13 +17,13 @@ class command():
|
||||
return ''
|
||||
|
||||
def run(self):
|
||||
if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'interruptOnKeyPress'):
|
||||
return
|
||||
if self.env['runtime']['inputManager'].noKeyPressed():
|
||||
return
|
||||
if len(self.env['input']['prevDeepestInput']) > len(self.env['input']['currInput']):
|
||||
return
|
||||
if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'interruptOnKeyPress'):
|
||||
return
|
||||
if self.env['screenData']['newTTY'] != self.env['screenData']['oldTTY']:
|
||||
if self.environment['runtime']['screenManager'].isScreenChange():
|
||||
return
|
||||
self.env['runtime']['outputManager'].interruptOutput()
|
||||
|
||||
|
@@ -18,22 +18,22 @@ class command():
|
||||
return ''
|
||||
|
||||
def run(self):
|
||||
if self.environment['runtime']['screenManager'].isScreenChange():
|
||||
if self.env['runtime']['screenManager'].isScreenChange():
|
||||
return
|
||||
if self.env['runtime']['inputManager'].noKeyPressed():
|
||||
return
|
||||
# detect an change on the screen, we just want to cursor arround, so no change should appear
|
||||
if self.environment['runtime']['screenManager'].isDelta():
|
||||
if self.env['runtime']['screenManager'].isDelta():
|
||||
return
|
||||
if self.environment['runtime']['screenManager'].isNegativeDelta():
|
||||
if self.env['runtime']['screenManager'].isNegativeDelta():
|
||||
return
|
||||
# is a vertical change?
|
||||
if self.environment['runtime']['cursorManager'].isCursorVerticalMove():
|
||||
if self.env['runtime']['cursorManager'].isCursorVerticalMove():
|
||||
return
|
||||
# is it a horizontal change?
|
||||
if not self.environment['runtime']['cursorManager'].isCursorHorizontalMove():
|
||||
if not self.env['runtime']['cursorManager'].isCursorHorizontalMove():
|
||||
return
|
||||
x, y, currChar, endOfScreen = char_utils.getCurrentChar(self.env['screenData']['newCursor']['x'], self.env['screenData']['newCursor']['y'], self.env['screenData']['newContentText'])
|
||||
x, y, currChar = char_utils.getCurrentChar(self.env['screenData']['newCursor']['x'], self.env['screenData']['newCursor']['y'], self.env['screenData']['newContentText'])
|
||||
if not currChar.isspace():
|
||||
self.env['runtime']['outputManager'].presentText(currChar, interrupt=True, ignorePunctuation=True, announceCapital=True)
|
||||
def setCallback(self, callback):
|
||||
|
@@ -20,15 +20,15 @@ class command():
|
||||
def run(self):
|
||||
if self.env['runtime']['inputManager'].noKeyPressed():
|
||||
return
|
||||
if self.environment['runtime']['screenManager'].isScreenChange():
|
||||
if self.env['runtime']['screenManager'].isScreenChange():
|
||||
return
|
||||
if self.environment['runtime']['screenManager'].isDelta():
|
||||
if self.env['runtime']['screenManager'].isDelta():
|
||||
return
|
||||
# is a vertical change?
|
||||
if not self.environment['runtime']['cursorManager'].isCursorVerticalMove():
|
||||
if not self.env['runtime']['cursorManager'].isCursorVerticalMove():
|
||||
return
|
||||
|
||||
x, y, currLine, endOfScreen = line_utils.getCurrentLine(self.env['screenData']['newCursor']['x'], self.env['screenData']['newCursor']['y'], self.env['screenData']['newContentText'])
|
||||
x, y, currLine = line_utils.getCurrentLine(self.env['screenData']['newCursor']['x'], self.env['screenData']['newCursor']['y'], self.env['screenData']['newContentText'])
|
||||
|
||||
if currLine.isspace():
|
||||
self.env['runtime']['outputManager'].presentText("blank", soundIcon='EmptyLine', interrupt=True)
|
||||
|
@@ -6,6 +6,7 @@
|
||||
|
||||
from core import debug
|
||||
from utils import word_utils
|
||||
import string
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
@@ -26,29 +27,27 @@ class command():
|
||||
return
|
||||
|
||||
# just when cursor move worddetection is needed
|
||||
if not self.environment['runtime']['cursorManager'].isCursorHorizontalMove():
|
||||
if not self.env['runtime']['cursorManager'].isCursorHorizontalMove():
|
||||
return
|
||||
if self.env['runtime']['inputManager'].noKeyPressed():
|
||||
return
|
||||
# for now no new line
|
||||
if self.environment['runtime']['cursorManager'].isCursorVerticalMove():
|
||||
if self.env['runtime']['cursorManager'].isCursorVerticalMove():
|
||||
return
|
||||
# is there a delta bigger than keyecho?
|
||||
if len(self.env['screenData']['newDelta']) > 1:
|
||||
return
|
||||
|
||||
|
||||
# get the word
|
||||
# get the word
|
||||
newContent = self.env['screenData']['newContentText'].split('\n')[self.env['screenData']['newCursor']['y']]
|
||||
x, y, currWord, endOfScreen = word_utils.getCurrentWord(self.env['screenData']['newCursor']['x'], 0, newContent)
|
||||
x, y, currWord = word_utils.getCurrentWord(self.env['screenData']['newCursor']['x'], 0, newContent)
|
||||
# was this a typed word?
|
||||
if self.env['screenData']['newDelta'] != '':
|
||||
if not(newContent[self.env['screenData']['oldCursor']['x']].strip(" \t\n") == '' and x != self.env['screenData']['oldCursor']['x']):
|
||||
if self.env['runtime']['screenManager'].isDelta():
|
||||
# is there a delta bigger than keyecho?
|
||||
if len(self.env['screenData']['newDelta']) > 1:
|
||||
return
|
||||
if not(newContent[self.env['screenData']['oldCursor']['x']].isspace() and x != self.env['screenData']['oldCursor']['x']):
|
||||
return
|
||||
else:
|
||||
# or just arrow arround?
|
||||
if not(newContent[self.env['screenData']['newCursor']['x']].strip(" \t\n") == '' and x != self.env['screenData']['newCursor']['x']):
|
||||
return
|
||||
if not(newContent[self.env['screenData']['newCursor']['x']].isspace() and x != self.env['screenData']['newCursor']['x']):
|
||||
return
|
||||
|
||||
if currWord != '':
|
||||
self.env['runtime']['outputManager'].presentText(currWord, interrupt=True)
|
||||
|
@@ -45,17 +45,17 @@ class command():
|
||||
return
|
||||
|
||||
# just when cursor move worddetection is needed
|
||||
if not self.environment['runtime']['cursorManager'].isCursorHorizontalMove():
|
||||
if not self.env['runtime']['cursorManager'].isCursorHorizontalMove():
|
||||
return
|
||||
|
||||
# for now no new line
|
||||
if self.environment['runtime']['cursorManager'].isCursorVerticalMove():
|
||||
if self.env['runtime']['cursorManager'].isCursorVerticalMove():
|
||||
return
|
||||
# more than a keyecho?
|
||||
if len(self.env['screenData']['newDelta']) > 1:
|
||||
return
|
||||
# deletion
|
||||
if self.environment['runtime']['screenManager'].isNegativeDelta():
|
||||
if self.env['runtime']['screenManager'].isNegativeDelta():
|
||||
return
|
||||
# first place could not be the end of a word
|
||||
if self.env['screenData']['newCursor']['x'] == 0:
|
||||
@@ -63,7 +63,7 @@ class command():
|
||||
|
||||
# get the word (just for speedup only look at current line
|
||||
newContent = self.env['screenData']['newContentText'].split('\n')[self.env['screenData']['newCursor']['y']]
|
||||
x, y, currWord, endOfScreen = word_utils.getCurrentWord(self.env['screenData']['newCursor']['x'], 0, newContent)
|
||||
x, y, currWord, endOfScreen, lineBreak = word_utils.getCurrentWord(self.env['screenData']['newCursor']['x'], 0, newContent)
|
||||
# was this a typed word?
|
||||
if self.env['screenData']['newDelta'] != '':
|
||||
if not(newContent[self.env['screenData']['oldCursor']['x']] in string.whitespace + '!"#$%&()*+,-./:;<=>?@[\\]^_{|}~' and x != self.env['screenData']['oldCursor']['x']):
|
||||
|
@@ -19,9 +19,9 @@ class command():
|
||||
def run(self):
|
||||
if self.env['runtime']['inputManager'].noKeyPressed():
|
||||
return
|
||||
if self.env['screenData']['newTTY'] != self.env['screenData']['oldTTY']:
|
||||
if self.env['runtime']['screenManager'].isScreenChange():
|
||||
return
|
||||
if self.env['screenData']['newCursor']['y'] != self.env['screenData']['oldCursor']['y']:
|
||||
if self.env['runtime']['cursorManager'].isCursorVerticalMove():
|
||||
return
|
||||
if len(self.env['input']['currInput']) != 1:
|
||||
return
|
||||
|
Reference in New Issue
Block a user