Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Andrew Burgess <aburgess@redhat.com>
Cc: Tom Tromey <tom@tromey.com>,
	 gdb-patches@sourceware.org,
	 Patryk Sondej <patryk.sondej@gmail.com>
Subject: Re: [PATCH] gdb: fix handling of raw ANSI escape sequences printed from Python
Date: Thu, 15 Jan 2026 10:17:34 -0700	[thread overview]
Message-ID: <87cy3ag5ht.fsf@tromey.com> (raw)
In-Reply-To: <877btiu8dq.fsf@redhat.com> (Andrew Burgess's message of "Thu, 15 Jan 2026 16:51:29 +0000")

>>>>> "Andrew" == Andrew Burgess <aburgess@redhat.com> writes:

>> If the pager is already parsing escape sequences and reacting
>> accordingly, then I wonder if there's any need at all for
>> ui_file::emit_style_escape.

Andrew> I'm not entirely sure what you mean here, but I do wonder if the
Andrew> m_applied_style should be moved from ui_file, and ui_file should
Andrew> become a pure interface class.

This is done in the redirection series :)

Anyway what I meant is that I think emit_style_escape is really only
implemented in a special way by the pager.  The reason for its
existence, IIRC, was to track the styles when wrapping.

However since the pager already tracks styles in a different way, then
it seems like there's no reason for any special code.

Andrew> It's kind-of weird that the pager class ends up tracking some state
Andrew> within its grandparent's ui_file::m_applied_style, but then it also
Andrew> needs to track and mirror some state from within
Andrew> m_stream::m_applied_state.

Andrew> I wonder if there should be a new class which inherits from ui_file
Andrew> which actually implements styling, and would be used for the basic
Andrew> streams.

I think only the pager really cares so, IMO anyway, it makes sense to
leave the logic there.

FWIW I have another series in progress that adds styling to error() and
it also required some changes to ui-file, though that's mostly
templatizing some classes so they can be used in other contexts.

Andrew> I'm going to check this in to both master, and the 17 branch.

I meant to mention a 17 backport, thanks for doing that.

Tom

      reply	other threads:[~2026-01-15 17:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-15 11:06 Andrew Burgess
2026-01-15 16:00 ` Tom Tromey
2026-01-15 16:51   ` Andrew Burgess
2026-01-15 17:17     ` Tom Tromey [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87cy3ag5ht.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=aburgess@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=patryk.sondej@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox