From 596f269621f575d84ca95b6328159577dbb3f436 Mon Sep 17 00:00:00 2001 From: mathieui Date: Wed, 17 Dec 2014 21:22:21 +0100 Subject: [PATCH] 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) --- src/windows/inputs.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/windows/inputs.py b/src/windows/inputs.py index d345443b..2cf719ba 100644 --- a/src/windows/inputs.py +++ b/src/windows/inputs.py @@ -534,6 +534,11 @@ class Input(Win): if 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 self.pos <= self.view_pos + max(self.width, 3))