From c8d74a7b4b341f7498a3827555451924cabdd0f1 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sat, 1 Jan 2022 01:34:48 -0700 Subject: Add style-escape methods to ui_file This adds emit_style_escape and reset_style methods to ui_file. These aren't used yet, but they will be once the pager is converted to be a ui_file subclass. --- gdb/ui-file.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'gdb/ui-file.c') diff --git a/gdb/ui-file.c b/gdb/ui-file.c index 354a7c3..2072fd8 100644 --- a/gdb/ui-file.c +++ b/gdb/ui-file.c @@ -74,6 +74,30 @@ ui_file::vprintf (const char *format, va_list args) /* See ui-file.h. */ void +ui_file::emit_style_escape (const ui_file_style &style) +{ + if (can_emit_style_escape () && style != m_applied_style) + { + m_applied_style = style; + this->puts (style.to_ansi ().c_str ()); + } +} + +/* See ui-file.h. */ + +void +ui_file::reset_style () +{ + if (can_emit_style_escape ()) + { + m_applied_style = ui_file_style (); + this->puts (m_applied_style.to_ansi ().c_str ()); + } +} + +/* See ui-file.h. */ + +void ui_file::printchar (int c, int quoter, bool async_safe) { char buf[4]; -- cgit v1.1