Update word_utils.py
This commit is contained in:
parent
9a004f27ca
commit
5c9327a575
@ -16,7 +16,7 @@ def getCurrentWord(currX,currY, currText):
|
|||||||
wrappedLines = currText.split('\n')
|
wrappedLines = currText.split('\n')
|
||||||
wordFound = False
|
wordFound = False
|
||||||
currWord = ''
|
currWord = ''
|
||||||
if x <= 0:
|
if x < 0:
|
||||||
if y != 0:
|
if y != 0:
|
||||||
y -= 1
|
y -= 1
|
||||||
currLine = wrappedLines[y].replace("\t"," ")
|
currLine = wrappedLines[y].replace("\t"," ")
|
||||||
@ -31,15 +31,17 @@ def getCurrentWord(currX,currY, currText):
|
|||||||
x = 0
|
x = 0
|
||||||
else:
|
else:
|
||||||
x += 1
|
x += 1
|
||||||
wordEnd = currLine[x + 1:].find(" ")
|
wordEnd = currLine[x + 2:].find(" ")
|
||||||
if wordEnd == -1:
|
if wordEnd == -1:
|
||||||
wordEnd = len(currLine)
|
wordEnd = len(currLine[x:])
|
||||||
else:
|
else:
|
||||||
wordEnd += x + 1
|
wordEnd += x + 1
|
||||||
currWord = currLine[x:wordEnd]
|
currWord = currLine[x:wordEnd]
|
||||||
wordFound = currWord.strip(" \t\n") != ''
|
wordFound = currWord.strip(" \t\n") != ''
|
||||||
|
print(currWord)
|
||||||
if wordFound:
|
if wordFound:
|
||||||
break
|
break
|
||||||
|
print(currWord)
|
||||||
if x == 0:
|
if x == 0:
|
||||||
if y != 0:
|
if y != 0:
|
||||||
y -= 1
|
y -= 1
|
||||||
@ -49,4 +51,5 @@ def getCurrentWord(currX,currY, currText):
|
|||||||
x = len(currLine) - 1
|
x = len(currLine) - 1
|
||||||
else:
|
else:
|
||||||
x -= 1
|
x -= 1
|
||||||
|
print(currWord)
|
||||||
return x, y, currWord
|
return x, y, currWord
|
||||||
|
Loading…
Reference in New Issue
Block a user