on peut déborder l'input (mais pas venir corriger le tout début de la ligne…)

This commit is contained in:
louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 2010-01-27 23:12:40 +00:00
parent e724584faa
commit 5f37b5273c

View file

@ -240,6 +240,10 @@ class Input(Win):
def do_command(self, key): def do_command(self, key):
(y, x) = self.win.getyx() (y, x) = self.win.getyx()
if x == self.width-1:
self.win.delch(0, 0)
self.win.move(y, x)
x -= 1
try: try:
self.text = self.text[:self.pos]+key.decode('utf-8')+self.text[self.pos:] self.text = self.text[:self.pos]+key.decode('utf-8')+self.text[self.pos:]
self.win.insstr(key) self.win.insstr(key)
@ -247,6 +251,7 @@ class Input(Win):
return return
self.win.move(y, x+1) self.win.move(y, x+1)
self.pos += 1 self.pos += 1
self.refresh()
def get_text(self): def get_text(self):
txt = self.text txt = self.text
@ -260,7 +265,6 @@ class Input(Win):
self.txt = self.input.gather() self.txt = self.input.gather()
def refresh(self): def refresh(self):
# return
self.win.noutrefresh() self.win.noutrefresh()
def clear_text(self): def clear_text(self):