[Bug tui/34134] GDB TUI misrenders colors once more than 255 color pairs are used
"cvs-commit at gcc dot gnu.org via Gdb-prs" <[email protected]>
| Newsgroups | gmane.comp.gdb.bugs.discuss |
|---|---|
| Message-ID | <[email protected]/bugzilla/> |
https://sourceware.org/bugzilla/show_bug.cgi?id=34134 --- Comment #1 from Sourceware Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Andrew Burgess <[email protected]>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=fbe7f20a0f098ca03913452b29f50f0dc8568f77 commit fbe7f20a0f098ca03913452b29f50f0dc8568f77 Author: Jakob Schäffeler <[email protected]> Date: Sat May 9 23:27:43 2026 +0200 gdb/tui: fix unexpected reuse of color pairs TUI translates ANSI styling sequences to curses color pairs. Currently, this process uses COLOR_PAIR, which only returns values from 0 to 255 which results in unexpected reuse of color pairs. Replacing wattron/wattroff with wcolor_set avoids the 256 color pair limit imposed by the COLOR_PAIR macro. However, wcolor_set takes a short for the pair index, limiting pairs to SHRT_MAX. To support the full range of COLOR_PAIRS (up to 65536 with ncurses 6.1+), init_pair is replaced with init_extended_pair, and the pair index is passed to wcolor_set via the opts parameter as an extended color pair, a documented ncurses extension. This also results in last_color_pair no longer being needed, and so it is removed. The extended color pair extension requires ncurses 6.1+, so a configure check has been added. The fallback path uses the older color pair API which limits GDB to SHRT_MAX (32767) color pairs. This patch was tested with make check-gdb TESTS="gdb.tui/*.exp" Additionally, I tested this with the python extension from the bug report. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=34134 Approved-By: Andrew Burgess <[email protected]> -- You are receiving this mail because: You are on the CC list for the bug.