Update chrys
This commit is contained in:
parent
74b51c4140
commit
7a2ccc9e8a
@ -67,27 +67,40 @@ def getNextWord(currX,currY, currText):
|
|||||||
wordFound = False
|
wordFound = False
|
||||||
currWord = ''
|
currWord = ''
|
||||||
currLine = wrappedLines[y].replace("\t"," ")
|
currLine = wrappedLines[y].replace("\t"," ")
|
||||||
if currLine[x] == ' ' and x + 1 < len(currLine):
|
|
||||||
x = x + 1
|
|
||||||
while not wordFound:
|
while not wordFound:
|
||||||
print(x,y)
|
xtmp = 0
|
||||||
x = currLine[x:].find(" ")
|
if x + 1 >= len(currLine):
|
||||||
if x == -1:
|
if y < len(wrappedLines):
|
||||||
if y != len(wrappedLines):
|
|
||||||
y += 1
|
y += 1
|
||||||
currLine = wrappedLines[y].replace("\t"," ")
|
currLine = wrappedLines[y].replace("\t"," ")
|
||||||
else:
|
else:
|
||||||
return currX, currY, ''
|
return currX, currY, ''
|
||||||
x = 0
|
x = 0
|
||||||
else:
|
else:
|
||||||
x += currLine[x + 1:].find(" ")
|
x += 1
|
||||||
|
xtmp = x
|
||||||
|
x = currLine[x:].find(" ")
|
||||||
|
if x == -1:
|
||||||
|
x = len(currLine)
|
||||||
|
continue
|
||||||
|
else:
|
||||||
|
if xtmp <> 0:
|
||||||
|
xtmp += 1
|
||||||
|
x += xtmp
|
||||||
|
if x + 1 < len(currLine):
|
||||||
wordEnd = currLine[x + 1:].find(" ")
|
wordEnd = currLine[x + 1:].find(" ")
|
||||||
|
else:
|
||||||
|
wordEnd = -1
|
||||||
if wordEnd == -1:
|
if wordEnd == -1:
|
||||||
wordEnd = len(currLine)
|
wordEnd = len(currLine)
|
||||||
else:
|
else:
|
||||||
wordEnd += x + 2
|
wordEnd += x + 1
|
||||||
|
if wordEnd >= len(currLine) and y + 1 >= len(wrappedLines):
|
||||||
|
return currX, currY, ''
|
||||||
currWord = currLine[x:wordEnd]
|
currWord = currLine[x:wordEnd]
|
||||||
wordFound = currWord.strip(" \t\n") != ''
|
wordFound = currWord.strip(" \t\n") != ''
|
||||||
|
if not wordFound:
|
||||||
|
x = wordEnd
|
||||||
return x, y, currWord
|
return x, y, currWord
|
||||||
|
|
||||||
currText = " das ist ein test\ntest das\ntesttest\n\ntest"
|
currText = " das ist ein test\ntest das\ntesttest\n\ntest"
|
||||||
|
Loading…
Reference in New Issue
Block a user