From 8aa22fcafdcb0a25e41eb12db292849342b4705b Mon Sep 17 00:00:00 2001 From: chrys Date: Tue, 13 Dec 2016 00:02:29 +0100 Subject: [PATCH] start fixing word wrapping --- src/fenrir/utils/word_utils.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/fenrir/utils/word_utils.py b/src/fenrir/utils/word_utils.py index 0df92429..0b9432d6 100644 --- a/src/fenrir/utils/word_utils.py +++ b/src/fenrir/utils/word_utils.py @@ -5,8 +5,8 @@ # By Chrys, Storm Dragon, and contributers. from core import debug -# X Y Word END -# -1, -1, '', True +# X Y Word END BREAK +# -1, -1, '', True False def getPrevWord(currX,currY, currText): lineBreak = False endOfScreen = False @@ -16,6 +16,7 @@ def getPrevWord(currX,currY, currText): if endOfScreen: return x, y, currWord, endOfScreen, lineBreak wrappedLines = currText.split('\n') + currLine = wrappedLines[y].replace("\t"," ") return x, y, currWord, endOfScreen, lineBreak def getCurrentWord(currX,currY, currText): @@ -25,8 +26,8 @@ def getCurrentWord(currX,currY, currText): return -1, -1, '', endOfScreen, lineBreak x = currX y = currY + currWord = '' wrappedLines = currText.split('\n') - currWord = '' currLine = wrappedLines[y].replace("\t"," ") return x, y, currWord, endOfScreen, lineBreak @@ -35,9 +36,9 @@ def getNextWord(currX,currY, currText): endOfScreen = False if currText == '': return -1, -1, '', endOfScreen, lineBreak - x = currX - y = currY + x, y, currWord, endOfScreen, lineBreak = getCurrentWord(currX,currY,currText) + if endOfScreen: + return x, y, currWord, endOfScreen, lineBreak wrappedLines = currText.split('\n') - currWord = '' currLine = wrappedLines[y].replace("\t"," ") return x, y, currWord, endOfScreen, lineBreak