Fix scrolling inside the input when the text is small enough to fit

(e.g. during a completion, the input might scroll due to the length of
the completed item, and not go back to its original state without this
change)
This commit is contained in:
mathieui 2014-12-17 21:22:21 +01:00
parent 92265678dc
commit 596f269621
No known key found for this signature in database
GPG key ID: C59F84CEEFD616E3

View file

@ -534,6 +534,11 @@ class Input(Win):
if self.view_pos < 0: if self.view_pos < 0:
self.view_pos = 0 self.view_pos = 0
# text small enough to fit inside the window entirely:
# remove scrolling if present
if poopt.wcswidth(self.text) < self.width:
self.view_pos = 0
assert(self.pos >= self.view_pos and assert(self.pos >= self.view_pos and
self.pos <= self.view_pos + max(self.width, 3)) self.pos <= self.view_pos + max(self.width, 3))