From af73b413eb8d143499c6f6d796aab5aa03efd75a Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Wed, 18 Oct 2017 15:26:06 +0100 Subject: Check whether curses.A_ITALIC exists, fixes a traceback on on Python < 3.7. --- poezio/windows/inputs.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'poezio/windows/inputs.py') diff --git a/poezio/windows/inputs.py b/poezio/windows/inputs.py index fca12e9d..faf0125d 100644 --- a/poezio/windows/inputs.py +++ b/poezio/windows/inputs.py @@ -467,6 +467,7 @@ class Input(Win): if y is not None and x is not None: self.move(y, x) format_char = find_first_format_char(text, chars) + has_italic = hasattr(curses, 'A_ITALIC') while format_char != -1: if text[format_char] == '\n': attr_char = '|' @@ -482,7 +483,7 @@ class Input(Win): self._win.attron(curses.A_UNDERLINE) elif attr_char == 'b': self._win.attron(curses.A_BOLD) - elif attr_char == 'i': + elif attr_char == 'i' and has_italic: self._win.attron(curses.A_ITALIC) elif attr_char in string.digits and attr_char != '': self._win.attron(to_curses_attr((int(attr_char), -1))) -- cgit v1.2.3