diff options
author | Jannik Hartung <peacemakerctf@gmail.com> | 2025-08-05 13:50:58 +0200 |
---|---|---|
committer | Jannik Hartung <peacemakerctf@gmail.com> | 2025-08-05 13:52:15 +0200 |
commit | 64917bab3caa10d89cb5ed160d20801065b7440b (patch) | |
tree | 6f03532f2d0bd7c8f017aeb147bab94b7e500cf6 /gdb/testsuite/gdb.python/py-lazy-string.c | |
parent | 2df2e47c5ae84fce2a51cd3d05abbd09f8a752c3 (diff) | |
download | gdb-64917bab3caa10d89cb5ed160d20801065b7440b.zip gdb-64917bab3caa10d89cb5ed160d20801065b7440b.tar.gz gdb-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.python/py-lazy-string.c')
0 files changed, 0 insertions, 0 deletions