--- /dev/null
+# Copyright 2023 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Check using a prompt with color in TUI.
+
+tuiterm_env
+
+Term::clean_restart 24 80
+
+# Set colored prompt.
+if {![Term::enter_tui]} {
+ unsupported "TUI not supported"
+ return
+}
+
+Term::command "set prompt \\033\[31m(gdb) \\033\[0m"
+
+set line [Term::get_line_with_attrs $Term::_cur_row]
+gdb_assert { [regexp "^<fg:red>$gdb_prompt <fg:default> *$" $line] } \
+ "prompt with color"
}
}
+ # Translate the color numbers as used in proc _csi_m to a name.
+ proc _color_attr { n } {
+ switch -exact -- $n {
+ 0 {
+ return black
+ }
+ 1 {
+ return red
+ }
+ 2 {
+ return green
+ }
+ 3 {
+ return yellow
+ }
+ 4 {
+ return blue
+ }
+ 5 {
+ return magenta
+ }
+ 6 {
+ return cyan
+ }
+ 7 {
+ return white
+ }
+ default { error "unsupported color number: $n" }
+ }
+ }
+
# Select Graphic Rendition.
#
# https://vt100.net/docs/vt510-rm/SGR.html
set _attrs(invisible) 0
}
30 - 31 - 32 - 33 - 34 - 35 - 36 - 37 {
- set _attrs(fg) $item
+ set _attrs(fg) [_color_attr [expr $item - 30]]
}
39 {
set _attrs(fg) default
}
40 - 41 - 42 - 43 - 44 - 45 - 46 - 47 {
- set _attrs(bg) $item
+ set _attrs(bg) [_color_attr [expr $item - 40]]
}
49 {
set _attrs(bg) default