aboutsummaryrefslogtreecommitdiff
path: root/gdb/ui-style.h
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2019-03-18 14:26:00 +0000
committerPedro Alves <palves@redhat.com>2019-03-18 14:26:00 +0000
commit55c10aca2e93cc7a4301aa1635ef9d6d73a804b1 (patch)
treef688304ed81cfb3aa05ef6735c7d89cf046b1177 /gdb/ui-style.h
parent647bb750c298bbee618aa4448a30dcf9adf23602 (diff)
downloadgdb-55c10aca2e93cc7a4301aa1635ef9d6d73a804b1.zip
gdb-55c10aca2e93cc7a4301aa1635ef9d6d73a804b1.tar.gz
gdb-55c10aca2e93cc7a4301aa1635ef9d6d73a804b1.tar.bz2
Improve/fix the TUI's current source line highlight
With styling enabled, I think the way we display the TUI's highlighted/current line is very ugly and distracting. The problem in my view is that we reverse foreground/background in colored text as well, leading to rainbow of background colors. This patch changes that to something that I find much more sensible -- only reverse the default foreground/background colors, leave styled text colors alone. If the foreground color is not the default (because the text was styled), leave the foreground color as is. If e.g., the terminal is fg=BLACK, and bg=WHITE, and the style wants to print text in RED, reverse the background color (print in BLACK), but still print the text in RED. Note: The new ui_file_style::set_fg method isn't called set_foreground instead, because set_foreground is a macro in /usr/lib/term.h (ncurses). gdb/ChangeLog: 2019-03-18 Pedro Alves <palves@redhat.com> * tui/tui-io.c (reverse_mode_p, reverse_save_bg, reverse_save_fg): New globals. (apply_style): New, factored out from ... (apply_ansi_escape): ... this. Handle reverse video mode. (tui_set_reverse_mode): New function. * tui/tui-io.h (tui_set_reverse_mode): New declaration. * tui/tui-winsource.c (tui_show_source_line): Use tui_set_reverse_mode instead of setting A_STANDOUT. * ui-style.h (struct ui_file_style) <set_reverse, set_fg, set_bg>: New setter methods.
Diffstat (limited to 'gdb/ui-style.h')
-rw-r--r--gdb/ui-style.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/gdb/ui-style.h b/gdb/ui-style.h
index 04a1d44..2a87fbe 100644
--- a/gdb/ui-style.h
+++ b/gdb/ui-style.h
@@ -180,18 +180,36 @@ struct ui_file_style
return m_reverse;
}
+ /* Set/clear the reverse display flag. */
+ void set_reverse (bool reverse)
+ {
+ m_reverse = reverse;
+ }
+
/* Return the foreground color of this style. */
const color &get_foreground () const
{
return m_foreground;
}
+ /* Set the foreground color of this style. */
+ void set_fg (color c)
+ {
+ m_foreground = c;
+ }
+
/* Return the background color of this style. */
const color &get_background () const
{
return m_background;
}
+ /* Set the background color of this style. */
+ void set_bg (color c)
+ {
+ m_background = c;
+ }
+
/* Return the intensity of this style. */
intensity get_intensity () const
{