This commit fixes PR gdb/32797, and pulls in just part of commit:
commit
6447969d0ac774b6dec0f95a0d3d27c27d158690
Date: Sat Oct 5 22:27:44 2024 +0300
Add an option with a color type.
to the gdb-16-branch.
This commit allows the escape sequences \x1b[39m and \x1b[49m, which
select the default foreground and background colours respectively, to
work correctly.
This fix is just a small part of the above commit. Only these two
changes are required to fix this bug. As we are currently preparing
for a 16.3 release, I don't think we should be pulling in the whole of
the above commit.
You can test this commit using:
export TERM=xterm-256color
gdb -q -tui -ex 'py print("normal\n\x1b[39mforeground default\n\x1b[0mnormal\n\x1b[49mbackground default\n\x1b[0mnormal\n")'
All of the output text should use the default foreground and
background colors.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32797
Approved-By: Tom Tromey <tom@tromey.com>
case 35:
case 36:
case 37:
+ m_foreground = color (value - 30);
+ break;
/* Note: not 38. */
case 39:
- m_foreground = color (value - 30);
+ m_foreground = NONE;
break;
case 40:
case 45:
case 46:
case 47:
+ m_background = color (value - 40);
+ break;
/* Note: not 48. */
case 49:
- m_background = color (value - 40);
+ m_background = NONE;
break;
case 90: