diff options
author | mathieui <mathieui@mathieui.net> | 2020-05-17 19:47:29 +0200 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2020-05-17 19:47:29 +0200 |
commit | 5bfca8a704b14bc4ba2d8cb1e5cfeb3cfa0afdca (patch) | |
tree | ff6b7a3b97124e4dca17aaa7d3be7274876a1c77 | |
parent | 20cb8f0bef811e7b470d4be36e7467a0da7177b5 (diff) | |
download | poezio-5bfca8a704b14bc4ba2d8cb1e5cfeb3cfa0afdca.tar.gz poezio-5bfca8a704b14bc4ba2d8cb1e5cfeb3cfa0afdca.tar.bz2 poezio-5bfca8a704b14bc4ba2d8cb1e5cfeb3cfa0afdca.tar.xz poezio-5bfca8a704b14bc4ba2d8cb1e5cfeb3cfa0afdca.zip |
Fix highlights color
-rw-r--r-- | poezio/windows/base_wins.py | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/poezio/windows/base_wins.py b/poezio/windows/base_wins.py index d6c72912..f371c106 100644 --- a/poezio/windows/base_wins.py +++ b/poezio/windows/base_wins.py @@ -80,15 +80,18 @@ class Win: @contextmanager def colored_text(self, color: Optional[Tuple]=None, attr: Optional[int]=None): """Context manager which sets up an attr/color when inside""" - if attr is None: - if color is not None: - attr = to_curses_attr(color) - else: - yield None - return - self._win.attron(attr) + if color is None and attr is None: + yield None + return + if color is not None: + mode = to_curses_attr(color) + if attr is not None: + mode = mode | attr + else: + mode = attr + self._win.attron(mode) yield None - self._win.attroff(attr) + self._win.attroff(mode) def addstr(self, *args) -> None: """ |