From 103d097acf2e96392482677107852cd2b06550c8 Mon Sep 17 00:00:00 2001
From: mathieui <mathieui@mathieui.net>
Date: Sun, 9 Jun 2013 15:18:39 +0200
Subject: 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
---
 src/windows.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

(limited to 'src')

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:
-- 
cgit v1.2.3