Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Burgess <aburgess@redhat.com>
To: Tom Tromey <tom@tromey.com>
Cc: 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 16:51:29 +0000	[thread overview]
Message-ID: <877btiu8dq.fsf@redhat.com> (raw)
In-Reply-To: <87h5smg92i.fsf@tromey.com>

Tom Tromey <tom@tromey.com> writes:

>>>>>> "Andrew" == Andrew Burgess <aburgess@redhat.com> writes:
>
> Andrew> Prior to this commit GDB would always forward any ANSI escape
> Andrew> sequences directly to the output stream, but this meant that GDB
> Andrew> didn't know which style was currently in effect.
>
> Andrew> The above commit changed GDB so that we would parse the ANSI escape
> Andrew> sequence, and then apply it to the output stream, this allowed GDB to
> Andrew> track which style was in use, which in turn meant that GDB could
> Andrew> correctly suspend the style and reapply it when the pager was
> Andrew> activated.
>
> I think I probably didn't fully understand this patch in retrospect.
>
> 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.

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

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

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

Then for pager, more of the state would actually reside within that
class, which I think would simplify the code slightly.

>
> Andrew> This can be easily fixed by starting from the current style, rather
> Andrew> than the default style.
>
> Approved-By: Tom Tromey <tom@tromey.com>

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

Thanks,
Andrew


  reply	other threads:[~2026-01-15 16:52 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 [this message]
2026-01-15 17:17     ` Tom Tromey

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=877btiu8dq.fsf@redhat.com \
    --to=aburgess@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=patryk.sondej@gmail.com \
    --cc=tom@tromey.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