Browse Source
Add a test-case that sets a prompt with color in TUI. The line containing the prompt is shown by get_line_with_attrs as follows: ... <fg:31>(gdb) <fg:default> ... The 31 means red, but only for foreground colors, for background colors 41 means red. Make this more readable by using color names for both foreground and background, such that we have instead: .... <fg:red>(gdb) <fg:default> ... Tested on x86_64-linux.users/aburgess/try-core-file-pid0
3 changed files with 88 additions and 3 deletions
@ -0,0 +1,32 @@ |
|||
# 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" |
|||
Loading…
Reference in new issue