aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.base
diff options
context:
space:
mode:
authorJannik Hartung <peacemakerctf@gmail.com>2025-08-05 13:50:58 +0200
committerJannik Hartung <peacemakerctf@gmail.com>2025-08-05 13:52:15 +0200
commit64917bab3caa10d89cb5ed160d20801065b7440b (patch)
tree6f03532f2d0bd7c8f017aeb147bab94b7e500cf6 /gdb/testsuite/gdb.base
parent2df2e47c5ae84fce2a51cd3d05abbd09f8a752c3 (diff)
downloadbinutils-64917bab3caa10d89cb5ed160d20801065b7440b.zip
binutils-64917bab3caa10d89cb5ed160d20801065b7440b.tar.gz
binutils-64917bab3caa10d89cb5ed160d20801065b7440b.tar.bz2
[UI/TUI] Add support for italic and underline ANSI escape sequences
The ANSI escape sequence translation layer in TUI mode strips italic or underlined text modes silently. You cannot output text formatted like that using `TuiWindow.write` in Python at the moment. Parse the ANSI escape sequences for italic and underlined text into the `ui_file_style` structure and apply it to the TUI window when applying styles, similar to preserving the bold/dim state already. A script like this shows italic and underlined text correctly now. ```python import gdb class TestTUIWindow: _tui_window: gdb.TuiWindow def __init__(self, tui_window: gdb.TuiWindow) -> None: self._tui_window = tui_window self._tui_window.title = "colors test" def render(self) -> None: self._tui_window.write(""" \x1b[4mThis is underlined.\x1b[24m And normal text. \x1b[3mThis is italic.\x1b[23m And normal text. """, True) gdb.register_window_type("colortest", TestTUIWindow) ``` And launching it with ``` source the_above_script.py tui new-layout test colortest 1 cmd 1 layout test ``` Approved-By: Tom Tromey <tom@tromey.com>
Diffstat (limited to 'gdb/testsuite/gdb.base')
-rw-r--r--gdb/testsuite/gdb.base/style.exp16
1 files changed, 8 insertions, 8 deletions
diff --git a/gdb/testsuite/gdb.base/style.exp b/gdb/testsuite/gdb.base/style.exp
index 47efb64..a6c18d3 100644
--- a/gdb/testsuite/gdb.base/style.exp
+++ b/gdb/testsuite/gdb.base/style.exp
@@ -323,10 +323,10 @@ proc run_style_tests { } {
gdb_test_no_output "set style version background 255"
gdb_test_no_output "set style version foreground #FED210"
gdb_test "show style version background" \
- "The \033\\\[38;2;254;210;16;48;5;255;22;27m.*\".*version.*\".*style.*\033\\\[m background color is: 255" \
+ "The \033\\\[38;2;254;210;16;48;5;255;22;23;24;27m.*\".*version.*\".*style.*\033\\\[m background color is: 255" \
"Version's 256-color background style"
gdb_test "show style version foreground" \
- "The \033\\\[38;2;254;210;16;48;5;255;22;27m.*\".*version.*\".*style.*\033\\\[m foreground color is: #FED210" \
+ "The \033\\\[38;2;254;210;16;48;5;255;22;23;24;27m.*\".*version.*\".*style.*\033\\\[m foreground color is: #FED210" \
"Version's TrueColor foreground style"
}
@@ -782,7 +782,7 @@ proc test_pagination_cmd_after_quit_styling {} {
-re "^apropos time\r\n" {
exp_continue
}
- -re "^\033\\\[39;49;1;27m\[^\r\n\]+\r\n" {
+ -re "^\033\\\[39;49;1;23;24;27m\[^\r\n\]+\r\n" {
exp_continue
}
-re "^$::pagination_prompt$" {
@@ -828,7 +828,7 @@ proc test_pagination_cmd_after_quit_styling {} {
# non-default style that was in use when pagination kicked in
# above.
gdb_test "maintenance time" \
- "^\"\033\\\[39;49;1;27mmaintenance time\033\\\[m\" takes a numeric argument\\."
+ "^\"\033\\\[39;49;1;23;24;27mmaintenance time\033\\\[m\" takes a numeric argument\\."
}
# Helper for test_pagination_prompt_styling. Return false if STR, a
@@ -995,20 +995,20 @@ proc test_pagination_continue_styling_1 { length } {
exp_continue
}
- -re "^The current logfile is \"\033\\\[32;49;22;27m(?:ax)+\033\\\[m" {
+ -re "^The current logfile is \"\033\\\[32;49;22;23;24;27m(?:ax)+\033\\\[m" {
exp_continue
}
- -re "^\r\n\033\\\[32;49;22;27m(?:ax)+\033\\\[m(?=--)" {
+ -re "^\r\n\033\\\[32;49;22;23;24;27m(?:ax)+\033\\\[m(?=--)" {
exp_continue
}
- -re "^\r\n\033\\\[32;49;22;27m(?:ax)+(?=--)" {
+ -re "^\r\n\033\\\[32;49;22;23;24;27m(?:ax)+(?=--)" {
set saw_bad_styling true
exp_continue
}
- -re "^\r\n\033\\\[32;49;22;27m(?:ax)+\033\\\[m\"\\.\r\n" {
+ -re "^\r\n\033\\\[32;49;22;23;24;27m(?:ax)+\033\\\[m\"\\.\r\n" {
exp_continue
}