diff options
author | Florent Le Coz <louiz@louiz.org> | 2014-08-01 16:00:01 +0200 |
---|---|---|
committer | Florent Le Coz <louiz@louiz.org> | 2014-08-01 16:00:01 +0200 |
commit | 271fd662a18d0a289fa73c1f42885a451accb1b8 (patch) | |
tree | 269f43afb5f345a4cb0bc290366aa96c17cbae45 /src/windows/inputs.py | |
parent | ba93f3f236e68b14d84c9bc621c638c4f79207f9 (diff) | |
download | poezio-271fd662a18d0a289fa73c1f42885a451accb1b8.tar.gz poezio-271fd662a18d0a289fa73c1f42885a451accb1b8.tar.bz2 poezio-271fd662a18d0a289fa73c1f42885a451accb1b8.tar.xz poezio-271fd662a18d0a289fa73c1f42885a451accb1b8.zip |
Entirely remove the g_lock (used to avoid a few race conditions with ncures)
Diffstat (limited to 'src/windows/inputs.py')
-rw-r--r-- | src/windows/inputs.py | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/src/windows/inputs.py b/src/windows/inputs.py index db339b77..ff13a562 100644 --- a/src/windows/inputs.py +++ b/src/windows/inputs.py @@ -10,7 +10,7 @@ import string import common import poopt -from . import Win, g_lock +from . import Win from . base_wins import format_chars from . funcs import find_first_format_char from config import config @@ -494,25 +494,24 @@ class Input(Win): length of text to display, and the position of the cursor. """ self.adjust_view_pos() - with g_lock: - text = self.text - self._win.erase() - if self.color: - self._win.attron(to_curses_attr(self.color)) - displayed_text = text[self.view_pos:self.view_pos+self.width-1].replace('\t', '\x18') - self._win.attrset(0) - self.addstr_colored_lite(displayed_text) - # Fill the rest of the line with the input color - if self.color: - (_, x) = self._win.getyx() - size = self.width - x - self.addnstr(' ' * size, size, to_curses_attr(self.color)) - self.addstr(0, - poopt.wcswidth(displayed_text[:self.pos-self.view_pos]), '') - if self.color: - self._win.attroff(to_curses_attr(self.color)) - curses.curs_set(1) - self._refresh() + text = self.text + self._win.erase() + if self.color: + self._win.attron(to_curses_attr(self.color)) + displayed_text = text[self.view_pos:self.view_pos+self.width-1].replace('\t', '\x18') + self._win.attrset(0) + self.addstr_colored_lite(displayed_text) + # Fill the rest of the line with the input color + if self.color: + (_, x) = self._win.getyx() + size = self.width - x + self.addnstr(' ' * size, size, to_curses_attr(self.color)) + self.addstr(0, + poopt.wcswidth(displayed_text[:self.pos-self.view_pos]), '') + if self.color: + self._win.attroff(to_curses_attr(self.color)) + curses.curs_set(1) + self._refresh() def adjust_view_pos(self): """ |