From 4ea8b2b3cee33337c8b894602572460ee4f45cde Mon Sep 17 00:00:00 2001 From: Ulf Magnusson Date: Wed, 27 Nov 2019 01:21:57 +0100 Subject: 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. --- menuconfig.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3