clean up broken word wrap, add , endOfScreen return value
This commit is contained in:
parent
763a1a26b5
commit
74aee822a3
41
src/fenrir/utils/word_utils2.py
Normal file
41
src/fenrir/utils/word_utils2.py
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
#!/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Fenrir TTY screen reader
|
||||||
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
|
from core import debug
|
||||||
|
# X Y Word END
|
||||||
|
# -1, -1, '', True
|
||||||
|
def getPrevWord(currX,currY, currText):
|
||||||
|
endOfScreen = False
|
||||||
|
if currText == '':
|
||||||
|
return -1, -1, '', endOfScreen
|
||||||
|
x, y, currWord, endOfScreen = getCurrentWord(currX,currY,currText)
|
||||||
|
if endOfScreen:
|
||||||
|
return x, y, currWord, endOfScreen
|
||||||
|
wrappedLines = currText.split('\n')
|
||||||
|
|
||||||
|
return x, y, currWord, endOfScreen
|
||||||
|
|
||||||
|
def getCurrentWord(currX,currY, currText):
|
||||||
|
endOfScreen = False
|
||||||
|
if currText == '':
|
||||||
|
return -1, -1, '', endOfScreen
|
||||||
|
x = currX
|
||||||
|
y = currY
|
||||||
|
wrappedLines = currText.split('\n')
|
||||||
|
currWord = ''
|
||||||
|
currLine = wrappedLines[y].replace("\t"," ")
|
||||||
|
return x, y, currWord, endOfScreen
|
||||||
|
|
||||||
|
def getNextWord(currX,currY, currText):
|
||||||
|
endOfScreen = False
|
||||||
|
if currText == '':
|
||||||
|
return -1, -1, '', endOfScreen
|
||||||
|
x = currX
|
||||||
|
y = currY
|
||||||
|
wrappedLines = currText.split('\n')
|
||||||
|
currWord = ''
|
||||||
|
currLine = wrappedLines[y].replace("\t"," ")
|
||||||
|
return x, y, currWord, endOfScreen
|
Loading…
Reference in New Issue
Block a user