Can print messages over multiple lines
This commit is contained in:
parent
d80e24f6c4
commit
aab322dcca
|
@ -12,19 +12,31 @@ import settings
|
|||
import bt.message
|
||||
|
||||
|
||||
def advance(y, maxy, stdscr):
|
||||
if y < (maxy-1):
|
||||
settings.replace("cliney", y+1)
|
||||
return y+1
|
||||
|
||||
stdscr.move(0,0)
|
||||
stdscr.deleteln()
|
||||
return y
|
||||
|
||||
|
||||
# Add string to line y
|
||||
def insert(string):
|
||||
stdscr = settings.get("stdscr")
|
||||
max = settings.get("maxyx")[0]
|
||||
maxyx = settings.get("maxyx")
|
||||
y = settings.get("cliney")
|
||||
|
||||
stdscr.addstr(y, 0, string)
|
||||
if len(string) > maxyx[1]:
|
||||
stdscr.addstr(y, 0, string[0:maxyx[1]])
|
||||
advance(y, maxyx[0], stdscr)
|
||||
insert(string[maxyx[1]:])
|
||||
return
|
||||
|
||||
stdscr.addstr(y, 0, string)
|
||||
advance(y, maxyx[0], stdscr)
|
||||
|
||||
if y < (max-1):
|
||||
settings.replace("cliney", y+1)
|
||||
else:
|
||||
stdscr.move(0,0)
|
||||
stdscr.deleteln()
|
||||
|
||||
|
||||
# Replace the string on the current line
|
||||
|
|
Loading…
Reference in New Issue