From 3cd7a64784a1a96e1540e1022d12147e496fe70d Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 2 Jul 2014 10:54:54 +0200 Subject: reduce flicker MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/__main__.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/__main__.py b/src/__main__.py index 16c935f..c502d7c 100755 --- a/src/__main__.py +++ b/src/__main__.py @@ -175,9 +175,15 @@ class Bar: self.gc.change(foreground = fc, background = bc) if clear is not None: (clear_y, line_height) = clear + ascent = line_height - self.font_height for c in text + '\0': if c in special: if not buf == '': + text_width = self.font_width * len(buf) + if clear is not None: + self.change_colour(self.background) + self.window.fill_rectangle(self.gc, x, clear_y, text_width, ascent) + self.gc.change(foreground = fc, background = bc) if len(buf.encode('utf-8')) > 255: while not buf == '': sbuf, buf = buf[:42], buf[42:] @@ -185,7 +191,7 @@ class Bar: x += self.font_width * len(sbuf) else: draw_text(self.window, self.gc, x, y, buf) - x += self.font_width * len(buf) + x += text_width buf = '' if not c == '\0': segs = [] -- cgit v1.2.3-70-g09d2