From ef1dfa3644f02efffa11d718fe5788c05177587b Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sat, 17 Nov 2018 11:49:25 -0700 Subject: Reset terminal styles This adds a function that can be used to reset terminal styles, regardless of what style the low-level output routines currently think 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-12-28 Tom Tromey * 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. --- gdb/printcmd.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'gdb/printcmd.c') diff --git a/gdb/printcmd.c b/gdb/printcmd.c index 8c99918..79c3d2d 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 (""); gdb_flush (gdb_stdout); } -- cgit v1.1