aboutsummaryrefslogtreecommitdiff
path: root/gdb/python
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2025-12-09 08:38:30 -0700
committerTom Tromey <tom@tromey.com>2026-02-09 08:15:29 -0700
commit0391f70c7d9d8cff7a2f651ba8b9b015d0e9ea5d (patch)
tree69c1249c4c49b336e514012bbbe14c5d5c110f6a /gdb/python
parenta444416787a19041dee2aa9b97c71f39085412c8 (diff)
downloadbinutils-0391f70c7d9d8cff7a2f651ba8b9b015d0e9ea5d.tar.gz
binutils-0391f70c7d9d8cff7a2f651ba8b9b015d0e9ea5d.tar.bz2
binutils-0391f70c7d9d8cff7a2f651ba8b9b015d0e9ea5d.zip
Remove m_applied_style from ui_file
While working on this series, I found a number of odd styling issues recurred. For instance, the issue where the pager would lose track and style subsequent output incorrectly reappeared. It turned out that different ui_file objects in the output pipeline would get confused about their current style. And, looking deeper at this, I realized that mainly it is the pager that really needs to track the current style at all. All the other file implementations can be purely reactive (except the buffered stream code, as Andrew pointed out). This patch moves m_applied_style from ui_file and into pager_file. This necessitated making ui_file::vprintf virtual, so that the base class could pass in the "plain" style as the starting point, whereas the pager could use the applied style. (I did not investigate whether this was truly necessary, and I somewhat suspect it might not be.) This straightforward approach caused some regressions, mostly involving extra ANSI escapes being emitted. I fixed most of these by arranging for ui_out::call_do_message to track styles a little more thoroughly. Co-Authored-By: Andrew Burgess <aburgess@redhat.com> Approved-By: Andrew Burgess <aburgess@redhat.com>
Diffstat (limited to 'gdb/python')
-rw-r--r--gdb/python/py-uiout.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/gdb/python/py-uiout.h b/gdb/python/py-uiout.h
index 159f1b22e46..21c068e9077 100644
--- a/gdb/python/py-uiout.h
+++ b/gdb/python/py-uiout.h
@@ -109,9 +109,10 @@ protected:
void do_text (const char *string) override
{ }
- void do_message (const ui_file_style &style,
+ void do_message (ui_file_style &current_style,
+ const ui_file_style &style,
const char *format, va_list args)
- override ATTRIBUTE_PRINTF (3,0)
+ override ATTRIBUTE_PRINTF (4, 0)
{ }
void do_wrap_hint (int indent) override