clean up broken word wrap, add , endOfScreen return value
This commit is contained in:
parent
5be38ed831
commit
763a1a26b5
@ -7,8 +7,9 @@
|
|||||||
from core import debug
|
from core import debug
|
||||||
|
|
||||||
def getPrevChar(currX,currY, currText):
|
def getPrevChar(currX,currY, currText):
|
||||||
|
endOfScreen = False
|
||||||
if currText == '':
|
if currText == '':
|
||||||
return -1, -1, ''
|
return -1, -1, '', endOfScreen
|
||||||
wrappedLines = currText.split('\n')
|
wrappedLines = currText.split('\n')
|
||||||
x = currX
|
x = currX
|
||||||
y = currY
|
y = currY
|
||||||
@ -16,51 +17,60 @@ def getPrevChar(currX,currY, currText):
|
|||||||
if y - 1 > 0:
|
if y - 1 > 0:
|
||||||
y -= 1
|
y -= 1
|
||||||
x = len(wrappedLines[y]) - 1
|
x = len(wrappedLines[y]) - 1
|
||||||
|
else:
|
||||||
|
endOfScreen = True
|
||||||
else:
|
else:
|
||||||
x -= 1
|
x -= 1
|
||||||
currChar = wrappedLines[y][x]
|
currChar = wrappedLines[y][x]
|
||||||
return x, y, currChar
|
return x, y, currChar, endOfScreen
|
||||||
|
|
||||||
def getCurrentChar(currX,currY, currText):
|
def getCurrentChar(currX,currY, currText):
|
||||||
|
endOfScreen = False
|
||||||
if currText == '':
|
if currText == '':
|
||||||
return -1, -1, ''
|
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, endOfScreen
|
||||||
|
|
||||||
def getUpChar(currX,currY, currText):
|
def getUpChar(currX,currY, currText):
|
||||||
|
endOfScreen = False
|
||||||
if currText == '':
|
if currText == '':
|
||||||
return -1, -1, ''
|
return -1, -1, '', endOfScreen
|
||||||
wrappedLines = currText.split('\n')
|
wrappedLines = currText.split('\n')
|
||||||
currY -= 1
|
currY -= 1
|
||||||
if currY < 0:
|
if currY < 0:
|
||||||
currY = 0
|
currY = 0
|
||||||
currChar = wrappedLines[currY][currX]
|
currChar = wrappedLines[currY][currX]
|
||||||
return currX, currY, currChar
|
return currX, currY, currChar, endOfScreen
|
||||||
|
|
||||||
def getDownChar(currX,currY, currText):
|
def getDownChar(currX,currY, currText):
|
||||||
|
endOfScreen = False
|
||||||
if currText == '':
|
if currText == '':
|
||||||
return -1, -1, ''
|
return -1, -1, '', endOfScreen
|
||||||
wrappedLines = currText.split('\n')
|
wrappedLines = currText.split('\n')
|
||||||
currY += 1
|
currY += 1
|
||||||
if currY >= len(wrappedLines):
|
if currY >= len(wrappedLines):
|
||||||
currY = len(wrappedLines) -1
|
currY = len(wrappedLines) -1
|
||||||
|
else:
|
||||||
|
endOfScreen = True
|
||||||
currChar = wrappedLines[currY][currX]
|
currChar = wrappedLines[currY][currX]
|
||||||
return currX, currY, currChar
|
return currX, currY, currChar, endOfScreen
|
||||||
|
|
||||||
def getLastCharInLine(currY, currText):
|
def getLastCharInLine(currY, currText):
|
||||||
|
endOfScreen = False
|
||||||
if currText == '':
|
if currText == '':
|
||||||
return -1, -1, ''
|
return -1, -1, '', endOfScreen
|
||||||
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
|
return currX, currY, currChar, endOfScreen
|
||||||
|
|
||||||
def getNextChar(currX,currY, currText):
|
def getNextChar(currX,currY, currText):
|
||||||
|
endOfScreen = False
|
||||||
if currText == '':
|
if currText == '':
|
||||||
return -1, -1, ''
|
return -1, -1, '', endOfScreen
|
||||||
wrappedLines = currText.split('\n')
|
wrappedLines = currText.split('\n')
|
||||||
x = currX
|
x = currX
|
||||||
y = currY
|
y = currY
|
||||||
@ -68,10 +78,12 @@ def getNextChar(currX,currY, currText):
|
|||||||
if y + 1 < len(wrappedLines) - 1:
|
if y + 1 < len(wrappedLines) - 1:
|
||||||
y += 1
|
y += 1
|
||||||
x = 0
|
x = 0
|
||||||
|
else:
|
||||||
|
endOfScreen = True
|
||||||
else:
|
else:
|
||||||
x += 1
|
x += 1
|
||||||
currChar = wrappedLines[y][x]
|
currChar = wrappedLines[y][x]
|
||||||
return x, y, currChar
|
return x, y, currChar, endOfScreen
|
||||||
|
|
||||||
def getPhonetic(currChar):
|
def getPhonetic(currChar):
|
||||||
if len(currChar) != 1:
|
if len(currChar) != 1:
|
||||||
|
@ -7,35 +7,42 @@
|
|||||||
from core import debug
|
from core import debug
|
||||||
|
|
||||||
def getPrevLine(currX,currY, currText):
|
def getPrevLine(currX,currY, currText):
|
||||||
|
endOfScreen = False
|
||||||
if currText == '':
|
if currText == '':
|
||||||
return -1, -1, ''
|
return -1, -1, '', endOfScreen
|
||||||
wrappedLines = currText.split('\n')
|
wrappedLines = currText.split('\n')
|
||||||
x = currX
|
x = currX
|
||||||
y = currY
|
y = currY
|
||||||
if y - 1 >= 0:
|
if y - 1 >= 0:
|
||||||
y -= 1
|
y -= 1
|
||||||
|
else:
|
||||||
|
endOfScreen = True
|
||||||
x = 0
|
x = 0
|
||||||
currLine = wrappedLines[y]
|
currLine = wrappedLines[y]
|
||||||
return x, y, currLine
|
return x, y, currLine, endOfScreen
|
||||||
|
|
||||||
def getCurrentLine(currX,currY, currText):
|
def getCurrentLine(currX,currY, currText):
|
||||||
|
endOfScreen = False
|
||||||
if currText == '':
|
if currText == '':
|
||||||
return -1, -1, ''
|
return -1, -1, '', endOfScreen
|
||||||
wrappedLines = currText.split('\n')
|
wrappedLines = currText.split('\n')
|
||||||
x = currX
|
x = currX
|
||||||
y = currY
|
y = currY
|
||||||
x = 0
|
x = 0
|
||||||
currLine = wrappedLines[y]
|
currLine = wrappedLines[y]
|
||||||
return x, y, currLine
|
return x, y, currLine, endOfScreen
|
||||||
|
|
||||||
def getNextLine(currX,currY, currText):
|
def getNextLine(currX,currY, currText):
|
||||||
|
endOfScreen = False
|
||||||
if currText == '':
|
if currText == '':
|
||||||
return -1, -1, ''
|
return -1, -1, '', endOfScreen
|
||||||
wrappedLines = currText.split('\n')
|
wrappedLines = currText.split('\n')
|
||||||
x = currX
|
x = currX
|
||||||
y = currY
|
y = currY
|
||||||
if y + 1 < len(wrappedLines):
|
if y + 1 < len(wrappedLines):
|
||||||
y += 1
|
y += 1
|
||||||
|
else:
|
||||||
|
endOfScreen = True
|
||||||
x = 0
|
x = 0
|
||||||
currLine = wrappedLines[y]
|
currLine = wrappedLines[y]
|
||||||
return x, y, currLine
|
return x, y, currLine, endOfScreen
|
||||||
|
Loading…
x
Reference in New Issue
Block a user