summaryrefslogtreecommitdiff
path: root/poezio/windows/base_wins.py
diff options
context:
space:
mode:
authorMaxime Buquet <pep@bouah.net>2020-05-17 21:34:50 +0200
committerMaxime Buquet <pep@bouah.net>2020-05-17 21:34:50 +0200
commit36a0281b6761371d5a42a14acc7f7081c0bf076c (patch)
tree35f39d2e623e03b1bc1d1b2e482875e2f362bbde /poezio/windows/base_wins.py
parent20cb8f0bef811e7b470d4be36e7467a0da7177b5 (diff)
parent551828607c7644d7af6b5889c7ffb2f28eeefee9 (diff)
downloadpoezio-36a0281b6761371d5a42a14acc7f7081c0bf076c.tar.gz
poezio-36a0281b6761371d5a42a14acc7f7081c0bf076c.tar.bz2
poezio-36a0281b6761371d5a42a14acc7f7081c0bf076c.tar.xz
poezio-36a0281b6761371d5a42a14acc7f7081c0bf076c.zip
Merge branch 'fix-highlights' into 'master'
Fix highlights See merge request poezio/poezio!102
Diffstat (limited to 'poezio/windows/base_wins.py')
-rw-r--r--poezio/windows/base_wins.py19
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:
"""