finish word wrappig, create util toolkit

This commit is contained in:
chrys
2016-07-22 16:57:43 +02:00
parent bd930a9692
commit 335ad9b71c
14 changed files with 206 additions and 234 deletions

View File

@@ -0,0 +1,35 @@
#!/bin/python
def getPrevLine(currX,currY, currText):
if currText == '':
return -1, -1, ''
wrappedLines = currText.split('\n')
x = currX
y = currY
if y - 1 >= 0:
y -= 1
x = 0
currLine = wrappedLines[y]
return x, y, currLine
def getCurrentLine(currX,currY, currText):
if currText == '':
return -1, -1, ''
wrappedLines = currText.split('\n')
x = currX
y = currY
x = 0
currLine = wrappedLines[y]
return x, y, currLine
def getNextLine(currX,currY, currText):
if currText == '':
return -1, -1, ''
wrappedLines = currText.split('\n')
x = currX
y = currY
if y + 1 < len(wrappedLines):
y += 1
x = 0
currLine = wrappedLines[y]
return x, y, currLine