finalize cleanup in API

This commit is contained in:
chrys 2016-12-03 02:04:38 +01:00
parent 4a5522e384
commit f4b86c37dc
27 changed files with 61 additions and 58 deletions

1
TODO
View File

@ -15,6 +15,7 @@ Known Bugs:
fd = os.open("/dev/tty5", os.O_RDONLY ) fd = os.open("/dev/tty5", os.O_RDONLY )
os.tcgetpgrp(fd) os.tcgetpgrp(fd)
- implement onScreenUpdate commands - implement onScreenUpdate commands
read highlighted text mode read highlighted text mode

View File

@ -71,7 +71,7 @@ layout=en
[screen] [screen]
driver=linux driver=linux
encoding=cp850 encoding=cp850
screenUpdateDelay=0.4 screenUpdateDelay=0.2
suspendingScreen= suspendingScreen=
autodetectSuspendingScreen=True autodetectSuspendingScreen=True

View File

@ -41,7 +41,7 @@ class command():
cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor() cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor()
# get the word # get the word
newContent = self.env['screenData']['newContentText'].split('\n')[cursorPos['y']] newContent = self.env['screenData']['newContentText'].split('\n')[cursorPos['y']]
x, y, currWord = word_utils.getCurrentWord(cursorPos['x'], 0, newContent) x, y, currWord, endOfScreen, lineBreak = word_utils.getCurrentWord(cursorPos['x'], 0, newContent)
currWord = currWord.strip(string.whitespace + '!"#$%&\()*+,-./:;<=§>?@[\\]^_{|}~') currWord = currWord.strip(string.whitespace + '!"#$%&\()*+,-./:;<=§>?@[\\]^_{|}~')
if currWord != '': if currWord != '':

View File

@ -43,7 +43,7 @@ class command():
# get the word # get the word
newContent = self.env['screenData']['newContentText'].split('\n')[cursorPos['y']] newContent = self.env['screenData']['newContentText'].split('\n')[cursorPos['y']]
x, y, currWord = word_utils.getCurrentWord(cursorPos['x'], 0, newContent) x, y, currWord, endOfScreen, lineBreak = word_utils.getCurrentWord(cursorPos['x'], 0, newContent)
currWord = currWord.strip(string.whitespace + '!"#$%&\()*+,-./:;<=§>?@[\\]^_{|}~') currWord = currWord.strip(string.whitespace + '!"#$%&\()*+,-./:;<=§>?@[\\]^_{|}~')
if not currWord.isspace(): if not currWord.isspace():
if self.spellChecker.is_removed(currWord): if self.spellChecker.is_removed(currWord):

View File

@ -20,7 +20,7 @@ class command():
def run(self): def run(self):
self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor() self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor()
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], currWord = \ self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], currWord, endOfScreen, lineBreak = \
word_utils.getCurrentWord(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText']) word_utils.getCurrentWord(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText'])
if currWord.isspace(): if currWord.isspace():

View File

@ -20,7 +20,7 @@ class command():
def run(self): def run(self):
self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor() self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor()
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], currWord = \ self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], currWord, endOfScreen, lineBreak = \
word_utils.getCurrentWord(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText']) word_utils.getCurrentWord(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText'])
if currWord.isspace(): if currWord.isspace():

View File

@ -19,7 +19,7 @@ class command():
def run(self): def run(self):
cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor() cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor()
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], downChar = \ self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], downChar, endOfScreen = \
char_utils.getDownChar(self.env['screenData']['newCursorReview']['x'],self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText']) char_utils.getDownChar(self.env['screenData']['newCursorReview']['x'],self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText'])
if downChar.isspace(): if downChar.isspace():
self.env['runtime']['outputManager'].presentText("line is empty" ,interrupt=True) self.env['runtime']['outputManager'].presentText("line is empty" ,interrupt=True)

View File

@ -22,14 +22,13 @@ class command():
cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor() cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor()
x, y, currLine = \ x, y, currLine = \
line_utils.getCurrentLine(cursorPos['x'], cursorPos['y'], self.env['screenData']['newContentText']) line_utils.getCurrentLine(cursorPos['x'], cursorPos['y'], self.env['screenData']['newContentText'])
if currLine.isspace():
self.env['runtime']['cursorManager'].setReviewCursorPosition((len(currLine) - len(currLine.lstrip())) self.env['runtime']['outputManager'].presentText("line is empty" ,interrupt=True)
,cursorPos['y']) return
self.env['runtime']['cursorManager'].setReviewCursorPosition((len(currLine) - len(currLine.lstrip())), cursorPos['y'])
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], currChar = \ 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']) char_utils.getCurrentChar(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText'])
if currChar.isspace():
self.env['runtime']['outputManager'].presentText("line is empty" ,interrupt=True)
else:
self.env['runtime']['outputManager'].presentText(currChar ,interrupt=True, ignorePunctuation=True, announceCapital=True) self.env['runtime']['outputManager'].presentText(currChar ,interrupt=True, ignorePunctuation=True, announceCapital=True)
self.env['runtime']['outputManager'].presentText("first char in line indent " + str(len(currLine) - len(currLine.lstrip())), interrupt=False) self.env['runtime']['outputManager'].presentText("first char in line indent " + str(len(currLine) - len(currLine.lstrip())), interrupt=False)

View File

@ -19,13 +19,13 @@ class command():
def run(self): def run(self):
self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor() self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor()
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], currChar = \ self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], nextChar, endOfScreen, lineBreak = \
char_utils.getNextChar(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText']) char_utils.getNextChar(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText'])
if currChar.isspace(): if nextChar.isspace():
self.env['runtime']['outputManager'].presentText("space", interrupt=True) self.env['runtime']['outputManager'].presentText("space", interrupt=True)
else: else:
self.env['runtime']['outputManager'].presentText(currChar, interrupt=True, ignorePunctuation=True, announceCapital=True) self.env['runtime']['outputManager'].presentText(nextChar, interrupt=True, ignorePunctuation=True, announceCapital=True)
def setCallback(self, callback): def setCallback(self, callback):
pass pass

View File

@ -20,7 +20,7 @@ class command():
def run(self): def run(self):
self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor() self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor()
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], nextChar = \ self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], nextChar, endOfScreen, lineBreak = \
char_utils.getNextChar(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText']) char_utils.getNextChar(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText'])
if nextChar.isspace(): if nextChar.isspace():

View File

@ -22,13 +22,13 @@ class command():
if not self.env['screenData']['newCursorReview']: if not self.env['screenData']['newCursorReview']:
self.env['screenData']['newCursorReview'] = self.env['screenData']['newCursor'].copy() self.env['screenData']['newCursorReview'] = self.env['screenData']['newCursor'].copy()
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], currLine = \ self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], nextLine, endOfScreen = \
line_utils.getNextLine(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText']) line_utils.getNextLine(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText'])
if currLine.isspace(): if nextLine.isspace():
self.env['runtime']['outputManager'].presentText("blank", soundIcon='EmptyLine', interrupt=True) self.env['runtime']['outputManager'].presentText("blank", soundIcon='EmptyLine', interrupt=True)
else: else:
self.env['runtime']['outputManager'].presentText(currLine, interrupt=True) self.env['runtime']['outputManager'].presentText(nextLine, interrupt=True)
def setCallback(self, callback): def setCallback(self, callback):
pass pass

View File

@ -22,13 +22,13 @@ class command():
if self.env['screenData']['newCursorReview'] == None: if self.env['screenData']['newCursorReview'] == None:
self.env['screenData']['newCursorReview'] = self.env['screenData']['newCursor'].copy() self.env['screenData']['newCursorReview'] = self.env['screenData']['newCursor'].copy()
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], currWord = \ self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], nextWord, endOfScreen, lineBreak = \
word_utils.getNextWord(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText']) word_utils.getNextWord(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText'])
if currWord.isspace(): if nextWord.isspace():
self.env['runtime']['outputManager'].presentText("blank", interrupt=True) self.env['runtime']['outputManager'].presentText("blank", interrupt=True)
else: else:
self.env['runtime']['outputManager'].presentText(currWord, interrupt=True) self.env['runtime']['outputManager'].presentText(nextWord, interrupt=True)
def setCallback(self, callback): def setCallback(self, callback):
pass pass

View File

@ -20,7 +20,7 @@ class command():
def run(self): def run(self):
self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor() self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor()
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], nextWord = \ self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], nextWord, endOfScreen, lineBreak = \
word_utils.getNextWord(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText']) word_utils.getNextWord(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText'])
if nextWord.isspace(): if nextWord.isspace():

View File

@ -22,13 +22,13 @@ class command():
if not self.env['screenData']['newCursorReview']: if not self.env['screenData']['newCursorReview']:
self.env['screenData']['newCursorReview'] = self.env['screenData']['newCursor'].copy() self.env['screenData']['newCursorReview'] = self.env['screenData']['newCursor'].copy()
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], currChar = \ self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], prevChar, endOfScreen, lineBreak = \
char_utils.getPrevChar(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText']) char_utils.getPrevChar(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText'])
if currChar.isspace(): if prevChar.isspace():
self.env['runtime']['outputManager'].presentText("space", interrupt=True) self.env['runtime']['outputManager'].presentText("space", interrupt=True)
else: else:
self.env['runtime']['outputManager'].presentText(currChar, interrupt=True, ignorePunctuation=True, announceCapital=True) self.env['runtime']['outputManager'].presentText(prevChar, interrupt=True, ignorePunctuation=True, announceCapital=True)
def setCallback(self, callback): def setCallback(self, callback):
pass pass

View File

@ -20,14 +20,14 @@ class command():
def run(self): def run(self):
self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor() self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor()
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], nextChar = \ self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], prevChar, endOfScreen, lineBreak = \
char_utils.getPrevChar(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText']) char_utils.getPrevChar(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText'])
if nextChar.isspace(): if prevChar.isspace():
self.env['runtime']['outputManager'].presentText("blank" ,interrupt=True) self.env['runtime']['outputManager'].presentText("blank" ,interrupt=True)
else: else:
nextChar = char_utils.getPhonetic(nextChar) prevChar = char_utils.getPhonetic(prevChar)
self.env['runtime']['outputManager'].presentText(nextChar ,interrupt=True, announceCapital=True) self.env['runtime']['outputManager'].presentText(prevChar ,interrupt=True, announceCapital=True)
def setCallback(self, callback): def setCallback(self, callback):
pass pass

View File

@ -20,13 +20,13 @@ class command():
def run(self): def run(self):
self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor() self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor()
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], currLine = \ self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], prevLine, endOfScreen = \
line_utils.getPrevLine(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText']) line_utils.getPrevLine(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText'])
if currLine.isspace(): if prevLine.isspace():
self.env['runtime']['outputManager'].presentText("blank", soundIcon='EmptyLine', interrupt=True) self.env['runtime']['outputManager'].presentText("blank", soundIcon='EmptyLine', interrupt=True)
else: else:
self.env['runtime']['outputManager'].presentText(currLine, interrupt=True) self.env['runtime']['outputManager'].presentText(prevLine, interrupt=True)
def setCallback(self, callback): def setCallback(self, callback):
pass pass

View File

@ -20,13 +20,13 @@ class command():
def run(self): def run(self):
self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor() self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor()
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], currWord = \ self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], prevWord, endOfScreen, lineBreak = \
word_utils.getPrevWord(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText']) word_utils.getPrevWord(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText'])
if currWord.isspace(): if prevWord.isspace():
self.env['runtime']['outputManager'].presentText("blank", interrupt=True) self.env['runtime']['outputManager'].presentText("blank", interrupt=True)
else: else:
self.env['runtime']['outputManager'].presentText(currWord, interrupt=True) self.env['runtime']['outputManager'].presentText(prevWord, interrupt=True)
def setCallback(self, callback): def setCallback(self, callback):
pass pass

View File

@ -20,7 +20,7 @@ class command():
def run(self): def run(self):
self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor() self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor()
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], prevWord = \ self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], prevWord, endOfScreen, lineBreak = \
word_utils.getPrevWord(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText']) word_utils.getPrevWord(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText'])
if prevWord.isspace(): if prevWord.isspace():

View File

@ -19,7 +19,7 @@ class command():
def run(self): def run(self):
cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor() cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor()
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], upChar = \ self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], upChar, endOfScreen = \
char_utils.getUpChar(self.env['screenData']['newCursorReview']['x'],self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText']) char_utils.getUpChar(self.env['screenData']['newCursorReview']['x'],self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText'])
if upChar.isspace(): if upChar.isspace():
self.env['runtime']['outputManager'].presentText("line is empty" ,interrupt=True) self.env['runtime']['outputManager'].presentText("line is empty" ,interrupt=True)

View File

@ -42,7 +42,7 @@ class command():
# get the word # get the word
newContent = self.env['screenData']['newContentText'].split('\n')[cursorPos['y']] newContent = self.env['screenData']['newContentText'].split('\n')[cursorPos['y']]
x, y, currWord = word_utils.getCurrentWord(cursorPos['x'], 0, newContent) x, y, currWord, endOfScreen, lineBreak = word_utils.getCurrentWord(cursorPos['x'], 0, newContent)
if not currWord.isspace(): if not currWord.isspace():
if not self.spellChecker.check(currWord): if not self.spellChecker.check(currWord):

View File

@ -23,7 +23,7 @@ class command():
if self.env['screenData']['newCursor']['x'] <= self.env['screenData']['oldCursor']['x']: if self.env['screenData']['newCursor']['x'] <= self.env['screenData']['oldCursor']['x']:
return return
# is there any change? # is there any change?
if not self.environment['runtime']['screenManager'].isDelta(): if not self.env['runtime']['screenManager'].isDelta():
return return
# big changes are no char (but the value is bigger than one maybe the differ needs longer than you can type, so a little strange random buffer for now) # big changes are no char (but the value is bigger than one maybe the differ needs longer than you can type, so a little strange random buffer for now)
if len(self.env['screenData']['newDelta']) > 3: if len(self.env['screenData']['newDelta']) > 3:

View File

@ -36,7 +36,8 @@ class command():
return return
# get the word # get the word
newContent = self.env['screenData']['newContentText'].split('\n')[self.env['screenData']['newCursor']['y']] newContent = self.env['screenData']['newContentText'].split('\n')[self.env['screenData']['newCursor']['y']]
x, y, currWord = 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? # was this a typed word?
if self.env['runtime']['screenManager'].isDelta(): if self.env['runtime']['screenManager'].isDelta():
# is there a delta bigger than keyecho? # is there a delta bigger than keyecho?

View File

@ -26,10 +26,10 @@ class command():
# More than just a deletion happend # More than just a deletion happend
if self.environment['runtime']['screenManager'].isDelta(): if self.env['runtime']['screenManager'].isDelta():
return return
# no deletion # no deletion
if not self.environment['runtime']['screenManager'].isNegativeDelta(): if not self.env['runtime']['screenManager'].isNegativeDelta():
return return
if self.env['runtime']['inputManager'].noKeyPressed(): if self.env['runtime']['inputManager'].noKeyPressed():
return return

View File

@ -10,7 +10,7 @@ def getPrevChar(currX,currY, currText):
lineBreak = False lineBreak = False
endOfScreen = False endOfScreen = False
if currText == '': if currText == '':
return -1, -1, '', endOfScreen return -1, -1, '', endOfScreen, lineBreak
wrappedLines = currText.split('\n') wrappedLines = currText.split('\n')
x = currX x = currX
y = currY y = currY
@ -20,6 +20,7 @@ def getPrevChar(currX,currY, currText):
x = len(wrappedLines[y]) - 1 x = len(wrappedLines[y]) - 1
lineBreak = True lineBreak = True
else: else:
lineBreak = False
endOfScreen = True endOfScreen = True
else: else:
x -= 1 x -= 1
@ -28,7 +29,7 @@ def getPrevChar(currX,currY, currText):
def getCurrentChar(currX,currY, currText): def getCurrentChar(currX,currY, currText):
if currText == '': if currText == '':
return -1, -1, '', endOfScreen return -1, -1, ''
wrappedLines = currText.split('\n') wrappedLines = currText.split('\n')
currChar = wrappedLines[currY][currX] currChar = wrappedLines[currY][currX]
return currX, currY, currChar return currX, currY, currChar
@ -62,19 +63,19 @@ def getDownChar(currX,currY, currText):
def getLastCharInLine(currY, currText): def getLastCharInLine(currY, currText):
endOfScreen = False endOfScreen = False
if currText == '': if currText == '':
return -1, -1, '', endOfScreen return -1, -1, ''
wrappedLines = currText.split('\n') wrappedLines = currText.split('\n')
currX = len(wrappedLines[currY].rstrip())-1 currX = len(wrappedLines[currY].rstrip())-1
if currX < 0: if currX < 0:
currX = 0 currX = 0
currChar = wrappedLines[currY][currX] currChar = wrappedLines[currY][currX]
return currX, currY, currChar, endOfScreen return currX, currY, currChar
def getNextChar(currX,currY, currText): def getNextChar(currX,currY, currText):
lineBreak = False lineBreak = False
endOfScreen = False endOfScreen = False
if currText == '': if currText == '':
return -1, -1, '', endOfScreen return -1, -1, '', endOfScreen, lineBreak
wrappedLines = currText.split('\n') wrappedLines = currText.split('\n')
x = currX x = currX
y = currY y = currY
@ -84,11 +85,12 @@ def getNextChar(currX,currY, currText):
x = 0 x = 0
lineBreak = True lineBreak = True
else: else:
lineBreak = False
endOfScreen = True endOfScreen = True
else: else:
x += 1 x += 1
currChar = wrappedLines[y][x] currChar = wrappedLines[y][x]
return x, y, currChar, endOfScreen return x, y, currChar, endOfScreen, lineBreak
def getPhonetic(currChar): def getPhonetic(currChar):
if len(currChar) != 1: if len(currChar) != 1:

View File

@ -24,7 +24,7 @@ def getPrevLine(currX,currY, currText):
def getCurrentLine(currX,currY, currText): def getCurrentLine(currX,currY, currText):
if currText == '': if currText == '':
return -1, -1, '', endOfScreen return -1, -1, ''
wrappedLines = currText.split('\n') wrappedLines = currText.split('\n')
x = currX x = currX
y = currY y = currY

View File

@ -11,10 +11,10 @@ def getPrevWord(currX,currY, currText):
lineBreak = False lineBreak = False
endOfScreen = False endOfScreen = False
if currText == '': if currText == '':
return -1, -1, '', endOfScreen return -1, -1, '', endOfScreen, lineBreak
x, y, currWord, endOfScreen = getCurrentWord(currX,currY,currText) x, y, currWord, endOfScreen, lineBreak = getCurrentWord(currX,currY,currText)
if endOfScreen: if endOfScreen:
return x, y, currWord, endOfScreen return x, y, currWord, endOfScreen, lineBreak
wrappedLines = currText.split('\n') wrappedLines = currText.split('\n')
return x, y, currWord, endOfScreen, lineBreak return x, y, currWord, endOfScreen, lineBreak
@ -22,7 +22,7 @@ def getCurrentWord(currX,currY, currText):
lineBreak = False lineBreak = False
endOfScreen = False endOfScreen = False
if currText == '': if currText == '':
return -1, -1, '', endOfScreen return -1, -1, '', endOfScreen, lineBreak
x = currX x = currX
y = currY y = currY
wrappedLines = currText.split('\n') wrappedLines = currText.split('\n')
@ -34,7 +34,7 @@ def getNextWord(currX,currY, currText):
lineBreak = False lineBreak = False
endOfScreen = False endOfScreen = False
if currText == '': if currText == '':
return -1, -1, '', endOfScreen return -1, -1, '', endOfScreen, lineBreak
x = currX x = currX
y = currY y = currY
wrappedLines = currText.split('\n') wrappedLines = currText.split('\n')