public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Tom Tromey <tom@tromey.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFC 0/8] add terminal styling to gdb
Date: Fri, 07 Sep 2018 14:56:00 -0000	[thread overview]
Message-ID: <83va7htkzj.fsf@gnu.org> (raw)
In-Reply-To: <87h8j1xtly.fsf@tromey.com> (message from Tom Tromey on Fri, 07	Sep 2018 08:36:09 -0600)

> From: Tom Tromey <tom@tromey.com>
> Cc: Tom Tromey <tom@tromey.com>,  gdb-patches@sourceware.org
> Date: Fri, 07 Sep 2018 08:36:09 -0600
> 
> >>>>> "Eli" == Eli Zaretskii <eliz@gnu.org> writes:
> 
> Eli> This is a worthy goal, IMO, but please allow a level of abstraction
> Eli> between output styles and ANSI escape sequences.  In particular, the
> Eli> assumption that changing a style or switching text attributes (like
> Eli> color, bold, etc.) requires to "emit" something to the terminal, is
> Eli> not necessarily true.  Please allow for terminals where doing that
> Eli> requires a function call that doesn't necessarily write anything to
> Eli> the terminal.
> 
> I assume you're talking about Windows here.

Yes, and there's also go32 (a.k.a. DJGPP, a.k.a. MSDOS).

> I don't know anything about Windows -- could you explain a bit about
> what's needed to support it?

To change the visual appearance of the following text, such as colors
or standout, you need to call a function.  then you write text as
usual, with printf etc., and it appears with the attributes requested
by that function call.  Then, when you want to get back to the
defaults, you need to call the same function again, but with a
different argument.  The argument tells what video attributes shall be
turned on or off.

If you want a working example, you can look at pcterm.c in the
Texinfo's info/ directory, it is used for the stand-alone Info reader.

> I can't implement it but I could probably rework the low-level code --
> the stuff that interacts with the pager and line wrap buffering -- to
> let the stylizing be done in a host-dependent way.

Yes, that's what I was asking for.  The actual implementation should
come from someone else (perhaps myself ;-).

> One idea would be to have the line-wrap buffer be a vector that
> alternates strings and styles.  Then the terminal-specific output
> functions could apply styles in whatever way is appropriate.  Would this
> work for Windows?

Sorry, I don't think I follow.  What is the line-wrap buffer, and how
is it related to the issue at hand?

> Eli> Finally, did you consider the use case of running GDB from Emacs (via
> Eli> the old GUD, which uses CLI I/O)?  Would the color escapes be disabled
> Eli> in that case, or would that require Emacs to interpret them?  Same
> Eli> question for other front-ends which use CLI, if there are such.
> 
> Based on experience with my colorizing frame filter, it should all be
> fine.
> 
> First, looking at gdb in Emacs right now, I see:
> 
>     (top-gdb) show env TERM
>     TERM = dumb
> 
> My patches use this to disable colorizing.
> 
> That's not the end of the story though.  comint.el puts
> ansi-color-process-output onto comint-output-filter-functions by
> default.  So, I think we could have gdb look at getenv("INSIDE_EMACS")
> and re-enable the colorizing by default.

Yes, I agree on both counts.

(I presume this feature is just for CLI, not for the MI output,
right?)

Thanks.

  reply	other threads:[~2018-09-07 14:56 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-06 21:13 Tom Tromey
2018-09-06 21:13 ` [RFC 6/8] Style print_address_symbolic Tom Tromey
2018-09-06 21:13 ` [RFC 4/8] Add variable name styling Tom Tromey
2018-10-06 16:34   ` Simon Marchi
2018-09-06 21:13 ` [RFC 2/8] Add a "context" argument to add_setshow_enum_cmd Tom Tromey
2018-09-06 21:13 ` [RFC 1/8] Change wrap buffering to use a std::string Tom Tromey
2018-10-06 15:19   ` Simon Marchi
2018-10-08 22:04     ` Tom Tromey
2018-10-18 22:16       ` Tom Tromey
2018-09-06 21:13 ` [RFC 7/8] Style the gdb welcome message Tom Tromey
2018-09-06 21:13 ` [RFC 3/8] Add output styles to gdb Tom Tromey
2018-10-06 15:53   ` Simon Marchi
2018-10-06 19:06     ` Tom Tromey
2018-10-07 21:58       ` Simon Marchi
2018-10-08  0:23         ` Tom Tromey
2018-10-08  2:02           ` Simon Marchi
2018-10-08  2:49             ` Tom Tromey
2018-10-08 11:10               ` Simon Marchi
2018-10-08 22:17                 ` Tom Tromey
2018-09-06 21:14 ` [RFC 5/8] Style locations when setting a breakpoint Tom Tromey
2018-10-06 16:36   ` Simon Marchi
2018-09-06 21:14 ` [RFC 8/8] Style the "Reading symbols" message Tom Tromey
2018-09-07  6:23 ` [RFC 0/8] add terminal styling to gdb Eli Zaretskii
2018-09-07 14:36   ` Tom Tromey
2018-09-07 14:56     ` Eli Zaretskii [this message]
2018-09-07 15:01       ` Eli Zaretskii
2018-09-07  7:25 ` Joel Brobecker
2018-10-04 13:11 ` Tom Tromey
2019-03-24 10:27 Konst Mayer
2019-03-25 15:07 ` 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=83va7htkzj.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    --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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).