summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlf Magnusson <ulfalizer@gmail.com>2019-11-27 01:21:57 +0100
committerUlf Magnusson <ulfalizer@gmail.com>2019-11-27 01:41:53 +0100
commit4ea8b2b3cee33337c8b894602572460ee4f45cde (patch)
treec9b6fcba8914c7ad2dbb4133b2d89c8217424ac9
parent3e1377ab3e5db201154bd78532b0e2cde08d287f (diff)
menuconfig: Ignore errors from use_default_colors()
Checking has_colors() isn't enough with with the winpty/msys2 setup in https://github.com/msys2/MINGW-packages/issues/5823, though it seems a bit broken. ncurses looks for either the orig_pair or the orig_color terminal capability, which is different from what has_colors() checks, so probably shouldn't assume use_default_colors() work on color terminals at least.
-rwxr-xr-xmenuconfig.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/menuconfig.py b/menuconfig.py
index 6eb0432..8962ac7 100755
--- a/menuconfig.py
+++ b/menuconfig.py
@@ -607,7 +607,15 @@ def _style_to_curses(style_def):
def _init_styles():
if curses.has_colors():
- curses.use_default_colors()
+ try:
+ curses.use_default_colors()
+ except curses.error:
+ # Ignore errors on funky terminals that support colors but not
+ # using default colors. Worst it can do is break transparency and
+ # the like. Ran across this with the MSYS2/winpty setup in
+ # https://github.com/msys2/MINGW-packages/issues/5823, though there
+ # seems to be a lot of general brokenness there.
+ pass
# Use the 'default' theme as the base, and add any user-defined style
# settings from the environment