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/utils.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'gdb/utils.h') diff --git a/gdb/utils.h b/gdb/utils.h index 9872a15..1f09ec2 100644 --- a/gdb/utils.h +++ b/gdb/utils.h @@ -439,6 +439,10 @@ extern void fputs_styled (const char *linebuffer, const ui_file_style &style, struct ui_file *stream); +/* Reset the terminal style to the default, if needed. */ + +extern void reset_terminal_style (struct ui_file *stream); + /* Display the host ADDR on STREAM formatted as ``0x%x''. */ extern void gdb_print_host_address_1 (const void *addr, struct ui_file *stream); -- cgit v1.1