aboutsummaryrefslogtreecommitdiff
path: root/gdb/ui-file.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2022-01-01 01:34:48 -0700
committerTom Tromey <tom@tromey.com>2022-03-29 12:46:24 -0600
commitc8d74a7b4b341f7498a3827555451924cabdd0f1 (patch)
tree549460704305e6e34c9ea3684a6729726102aac8 /gdb/ui-file.c
parent9b7167182d1f6fef32c264587bbc00c7f9bd21f2 (diff)
downloadgdb-c8d74a7b4b341f7498a3827555451924cabdd0f1.zip
gdb-c8d74a7b4b341f7498a3827555451924cabdd0f1.tar.gz
gdb-c8d74a7b4b341f7498a3827555451924cabdd0f1.tar.bz2
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.
Diffstat (limited to 'gdb/ui-file.c')
-rw-r--r--gdb/ui-file.c24
1 files changed, 24 insertions, 0 deletions
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];