[PATCH 06/16] Reset terminal styles

Joel Brobecker brobecker@adacore.com
Mon Dec 24 04:16:00 GMT 2018


Hi Tom,

> This adds a function that can be used to reset terminal styles,
> regardless of what style the low-levle output routines currently think

Typo: levle -> level

> is applied.
> 
> This is used to make "echo" and "printf" work properly when emitting
> ANSI terminal escapes -- now gdb will reset the style at the end of
> the command.
> 
> gdb/ChangeLog
> 2018-11-27  Tom Tromey  <tom@tromey.com>
> 
> 	* utils.h (reset_terminal_style): Declare.
> 	* utils.c (can_emit_style_escape): New function.
> 	(set_output_style): Use it.
> 	(reset_terminal_style): New function.
> 	* printcmd.c (printf_command): Call reset_terminal_style.
> 	* cli/cli-cmds.c (echo_command): Call reset_terminal_style.

OK with me. Just one question below.

> diff --git a/gdb/printcmd.c b/gdb/printcmd.c
> index 8c999188d7..79c3d2d2ff 100644
> --- a/gdb/printcmd.c
> +++ b/gdb/printcmd.c
> @@ -2609,6 +2609,8 @@ static void
>  printf_command (const char *arg, int from_tty)
>  {
>    ui_printf (arg, gdb_stdout);
> +  reset_terminal_style (gdb_stdout);
> +  wrap_here ("");

Can you explain why you added the "wrap_here"?


-- 
Joel



More information about the Gdb-patches mailing list