summaryrefslogtreecommitdiff
path: root/src/window.py
diff options
context:
space:
mode:
authorlouiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13>2010-01-31 00:25:17 +0000
committerlouiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13>2010-01-31 00:25:17 +0000
commite273c57235c6007de13fa2fccf757e06c70d43dd (patch)
treec979f8b88460ba96d0755c9021b95234346cb51d /src/window.py
parentad00f721fae0fc10efb23369479152e93cb8aad6 (diff)
downloadpoezio-e273c57235c6007de13fa2fccf757e06c70d43dd.tar.gz
poezio-e273c57235c6007de13fa2fccf757e06c70d43dd.tar.bz2
poezio-e273c57235c6007de13fa2fccf757e06c70d43dd.tar.xz
poezio-e273c57235c6007de13fa2fccf757e06c70d43dd.zip
fixed #1123
Diffstat (limited to 'src/window.py')
-rw-r--r--src/window.py31
1 files changed, 27 insertions, 4 deletions
diff --git a/src/window.py b/src/window.py
index c4774342..5f599790 100644
--- a/src/window.py
+++ b/src/window.py
@@ -215,26 +215,49 @@ class Input(Win):
def key_home(self):
self.pos = 0
+ if len(self.text) >= self.width-1:
+ txt = self.text[:self.width-1]
+ self.clear_text()
+ self.win.addstr(txt)
self.win.move(0, 0)
self.refresh()
def key_end(self):
self.pos = len(self.text)
- self.win.move(0, len(self.text))
+ if len(self.text) >= self.width-1:
+ txt = self.text[-(self.width-1):]
+ self.clear_text()
+ self.win.addstr(txt)
+ self.win.move(0, self.width-1)
+ else:
+ self.win.move(0, len(self.text))
self.refresh()
def key_left(self):
(y, x) = self.win.getyx()
if self.pos > 0:
self.pos -= 1
- self.win.move(y, x-1)
+ if x == 0:
+ txt = self.text[self.pos:self.pos+self.width-1]
+ self.clear_text()
+ self.win.addstr(txt)
+ self.win.move(y, 0)
+ else:
+ self.win.move(y, x-1)
self.refresh()
def key_right(self):
(y, x) = self.win.getyx()
if self.pos < len(self.text):
self.pos += 1
- self.win.move(y, x+1)
+ if x == self.width-1:
+ txt = self.text[self.pos-(self.width-1):self.pos]
+ open('fion', 'w').write(txt)
+ self.clear_text()
+ self.win.addstr(txt)
+ self.win.move(y, self.width-1)
+ else:
+ self.win.move(y, x+1)
self.refresh()
def key_backspace(self):
@@ -249,7 +272,7 @@ class Input(Win):
(y, x) = self.win.getyx()
if x == self.width-1:
self.win.delch(0, 0)
- self.win.move(y, x)
+ self.win.move(y, x-1)
x -= 1
try:
self.text = self.text[:self.pos]+key.decode('utf-8')+self.text[self.pos:]