Re: [PATCH] gdb: Make startup message more user friendly

Guinevere Larsen
2025-10-13T20:31:31Z

On 10/10/25 5:09 PM, Tom Tromey wrote:
>>>>>> "Guinevere" == Guinevere Larsen <guinevere@redhat.com> writes:
> Guinevere> This commit attempts to make the startup message more friendly to new
> Guinevere> users by using ascii art separators. If there is enough space availabe,
> Guinevere> an ascii art box is printed containing the hints, otherwise a simple
> Guinevere> separator is printed. The code deems "enough space available" when
> Guinevere> there is enough space to print the documentation URL inside the box,
> Guinevere> since the other hints will be broken into multiple lines if necessary.
> Guinevere> Here are examples of the 2 possible startups, with enough space:
>
> If emojis_ok() then it seems like this could use Unicode line drawing
> instead.
Good idea, I'll look into that
> Guinevere> Unfortunately, I was not able to think of a way in which the code could
> Guinevere> break a line if necessary and also include styled code for URLs and
> Guinevere> commands, so, since I believe it is more important to have the box as
> Guinevere> available as possible, I opted to not include any styling options.
>
> I'm not sure I really understand the problem but I think this would be a
> step backward.
>
> There are facilities to manipulate these sequences. E.g. see what
> no_terminal_escape_file or escape_buffering_file do.

It's not that I don't know how to recognize the sequences, but rather
that I didn't know how to handle the %ps for counting spaces.

I guess I would need to apply the style and check the gdb_byte* for the
spaces? How would I go about that?

>
> One option might be to reimplement this as a ui_file that will only
> split at un-styled spaces; and if the screen isn't big enough just omit
> the box. Then print_gdb_hints wouldn't need two branches printing the
> same stuff.
I think implementing a ui_file would be overboard. If the style has been
pre-applied, the function box_one_message can be print_starter_hint, and
be generic enough to not need the multiple paths.

--
Cheers,
Guinevere Larsen
It/she