[RFA 1/4] Add highlight style, title style, fputs_highlighted. Improve 'show style'

Tom Tromey tom@tromey.com
Fri May 31 20:10:00 GMT 2019


>>>>> "Philippe" == Philippe Waroquiers <philippe.waroquiers@skynet.be> writes:

Philippe> Have 'show style' and its subcommands using a style to style its output.
Philippe> This allows the GDB user or developer to use 'show style' to visually see
Philippe> with one command how all the current styles look like.

Thanks.

Philippe> +static void
Philippe> +do_show (const char *what, struct ui_file *file,
Philippe> +	 struct cmd_list_element *cmd,
Philippe> +	 const char *value)

This needs some introductory comment.

Philippe> +{
Philippe> +  cli_style_option *cso = (cli_style_option *) get_cmd_context (cmd);
Philippe> +  fputs_filtered (_("The \""), file);
Philippe> +  fprintf_styled (file, cso->style (), "%s", cso->name ());

Can't this use fputs_styled instead?

It seems like the output might be a bit odd, in that the text will refer
to one aspect of the style, but it will be styled using the entire
style.

Philippe> +readibility."));

Typo, "readability".

Philippe> +      /* Output the part before pmatch with current style.  */
Philippe> +      while (pmatch.rm_so > 0)
Philippe> +	{
Philippe> +	  fputc_filtered (*str, stream);
Philippe> +	  pmatch.rm_so--;
Philippe> +	  str++;

Sometimes I wish the lower layers of the I/O system dealt with
string views instead of terminated strings...

I wondered if "highlight" was too generic a name, but I suppose it fits
well enough.  The only other idea I came up with was "search", which in
the end didn't really seem better.

Tom



More information about the Gdb-patches mailing list