aboutsummaryrefslogtreecommitdiff
path: root/gdb/ui-style.h
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/ui-style.h')
-rw-r--r--gdb/ui-style.h62
1 files changed, 59 insertions, 3 deletions
diff --git a/gdb/ui-style.h b/gdb/ui-style.h
index 77a175d..1ea3556 100644
--- a/gdb/ui-style.h
+++ b/gdb/ui-style.h
@@ -266,7 +266,9 @@ struct ui_file_style
return (m_foreground == other.m_foreground
&& m_background == other.m_background
&& m_intensity == other.m_intensity
- && m_reverse == other.m_reverse);
+ && m_reverse == other.m_reverse
+ && m_italic == other.m_italic
+ && m_underline == other.m_underline);
}
bool operator!= (const ui_file_style &other) const
@@ -284,7 +286,9 @@ struct ui_file_style
return (m_foreground == NONE
&& m_background == NONE
&& m_intensity == NORMAL
- && !m_reverse);
+ && !m_reverse
+ && !m_italic
+ && !m_underline);
}
/* Return true if this style specified reverse display; false
@@ -330,6 +334,32 @@ struct ui_file_style
return m_intensity;
}
+ /* Return true if this style specified italic display; false
+ otherwise. */
+ bool is_italic () const
+ {
+ return m_italic;
+ }
+
+ /* Set/clear the italic display flag. */
+ void set_italic (bool italic)
+ {
+ m_italic = italic;
+ }
+
+ /* Return true if this style specified underline display; false
+ otherwise. */
+ bool is_underline () const
+ {
+ return m_underline;
+ }
+
+ /* Set/clear the underline display flag. */
+ void set_underline (bool underline)
+ {
+ m_underline = underline;
+ }
+
/* Parse an ANSI escape sequence in BUF, modifying this style. BUF
must begin with an ESC character. Return true if an escape
sequence was successfully parsed; false otherwise. In either
@@ -351,14 +381,40 @@ private:
color m_foreground = NONE;
color m_background = NONE;
intensity m_intensity = NORMAL;
+ bool m_italic = false;
+ bool m_underline = false;
bool m_reverse = false;
};
+/* Possible results for checking an ANSI escape sequence. */
+enum class ansi_escape_result
+{
+ /* The escape sequence is definitely not recognizable. */
+ NO_MATCH,
+
+ /* The escape sequence might be recognizable with more input. */
+ INCOMPLETE,
+
+ /* The escape sequence is definitely recognizable. */
+ MATCHED,
+};
+
+/* Examine an ANSI escape sequence in BUF. BUF must begin with an ESC
+ character. Return a value indicating whether the sequence was
+ recognizable. If MATCHED is returned, then N_READ is updated to
+ reflect the number of chars read from BUF. */
+
+extern ansi_escape_result examine_ansi_escape (const char *buf, int *n_read);
+
/* Skip an ANSI escape sequence in BUF. BUF must begin with an ESC
character. Return true if an escape sequence was successfully
skipped; false otherwise. If an escape sequence was skipped,
N_READ is updated to reflect the number of chars read from BUF. */
-extern bool skip_ansi_escape (const char *buf, int *n_read);
+static inline bool
+skip_ansi_escape (const char *buf, int *n_read)
+{
+ return examine_ansi_escape (buf, n_read) == ansi_escape_result::MATCHED;
+}
#endif /* GDB_UI_STYLE_H */