From 0391f70c7d9d8cff7a2f651ba8b9b015d0e9ea5d Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Tue, 9 Dec 2025 08:38:30 -0700 Subject: 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 Approved-By: Andrew Burgess --- gdb/python/py-uiout.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'gdb/python') 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 ¤t_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 -- cgit v1.2.3