diff options
author | Ian Ward <ian@excess.org> | 2014-10-17 11:14:18 -0400 |
---|---|---|
committer | Ian Ward <ian@excess.org> | 2014-10-17 11:14:18 -0400 |
commit | d060224342e466dddfcecaed1fb18df2b2670e5c (patch) | |
tree | b368f5e3ed04b152787568d081791f52328e12d2 | |
parent | 4b65912ac1e5aaac4c7794f41fca2db655e9d9d4 (diff) | |
parent | 5ff0b98cf438531e395422bd1bd992b1d89ef110 (diff) | |
download | urwid-d060224342e466dddfcecaed1fb18df2b2670e5c.tar.gz |
Merge pull request #75 from rwarren/bright_bg_for_linux_term
fix bright bg rendering on linux term
-rw-r--r-- | urwid/raw_display.py | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/urwid/raw_display.py b/urwid/raw_display.py index 4853a83..86ac654 100644 --- a/urwid/raw_display.py +++ b/urwid/raw_display.py @@ -75,7 +75,8 @@ class Screen(BaseScreen, RealTerminal): self._rows_used = None self._cy = 0 term = os.environ.get('TERM', '') - self.bright_is_bold = not term.startswith("xterm") + self.fg_bright_is_bold = not term.startswith("xterm") + self.bg_bright_is_blink = (term == "linux") self.back_color_erase = not term.startswith("screen") self._next_timeout = None @@ -916,7 +917,7 @@ class Screen(BaseScreen, RealTerminal): fg = "38;5;%d" % a.foreground_number elif a.foreground_basic: if a.foreground_number > 7: - if self.bright_is_bold: + if self.fg_bright_is_bold: fg = "1;%d" % (a.foreground_number - 8 + 30) else: fg = "%d" % (a.foreground_number - 8 + 90) @@ -930,8 +931,11 @@ class Screen(BaseScreen, RealTerminal): bg = "48;5;%d" % a.background_number elif a.background_basic: if a.background_number > 7: - # this doesn't work on most terminals - bg = "%d" % (a.background_number - 8 + 100) + if self.bg_bright_is_blink: + bg = "5;%d" % (a.background_number - 8 + 40) + else: + # this doesn't work on most terminals + bg = "%d" % (a.background_number + 100) else: bg = "%d" % (a.background_number + 40) else: @@ -955,16 +959,16 @@ class Screen(BaseScreen, RealTerminal): if colors is None: colors = self.colors if bright_is_bold is None: - bright_is_bold = self.bright_is_bold + bright_is_bold = self.fg_bright_is_bold if has_underline is None: has_underline = self.has_underline - if colors == self.colors and bright_is_bold == self.bright_is_bold \ + if colors == self.colors and bright_is_bold == self.fg_bright_is_bold \ and has_underline == self.has_underline: return self.colors = colors - self.bright_is_bold = bright_is_bold + self.fg_bright_is_bold = bright_is_bold self.has_underline = has_underline self.clear() |