summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2013-06-09 15:18:39 +0200
committermathieui <mathieui@mathieui.net>2013-06-09 15:18:39 +0200
commit103d097acf2e96392482677107852cd2b06550c8 (patch)
tree01a76d8da14ddfbdf074b23bb04e5fcf326d0d84
parent9d5fddf5bad0e94f3945488e4174b7a8ade58f57 (diff)
downloadpoezio-103d097acf2e96392482677107852cd2b06550c8.tar.gz
poezio-103d097acf2e96392482677107852cd2b06550c8.tar.bz2
poezio-103d097acf2e96392482677107852cd2b06550c8.tar.xz
poezio-103d097acf2e96392482677107852cd2b06550c8.zip
Fix #2183 (do not scroll one char at a time when you reach the end)
Now it scrolls horizontally of 1/4 the size of the input
-rw-r--r--src/windows.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/windows.py b/src/windows.py
index 1bca14af..d046ddd7 100644
--- a/src/windows.py
+++ b/src/windows.py
@@ -1418,11 +1418,11 @@ class Input(Win):
if reset:
self.reset_completion()
self.text = self.text[:self.pos+self.line_pos]+key+self.text[self.pos+self.line_pos:]
- for i in range(len(key)):
- if self.pos >= self.width-1:
- self.line_pos += 1 # wcwidth.wcswidth(key)
- else:
- self.pos += 1 # wcwidth.wcswidth(key)
+ if self.pos + len(key) >= self.width - 1:
+ self.line_pos += self.pos + len(key) - (3*(self.width//4))
+ self.pos = 3*(self.width//4)
+ else:
+ self.pos += len(key)
if reset:
self.rewrite_text()
if self.on_input: