diff options
author | Tom Tromey <tom@tromey.com> | 2019-11-09 14:13:13 -0700 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2019-12-01 11:59:23 -0700 |
commit | a2a7af0c33869f08a999d5d1b301017138cbeb7a (patch) | |
tree | abf38fc4ea8f60ce1ac2d72fc368cb2801322721 /gdb/tui | |
parent | d1da6b01608841c846aa75209248e276f49e1587 (diff) | |
download | gdb-a2a7af0c33869f08a999d5d1b301017138cbeb7a.zip gdb-a2a7af0c33869f08a999d5d1b301017138cbeb7a.tar.gz gdb-a2a7af0c33869f08a999d5d1b301017138cbeb7a.tar.bz2 |
Add TUI border colors
This adds the ability to change the color of the TUI borders, both
ordinary and active. Unlike other styling options, this doesn't allow
setting the intensity, because that is already done by the TUI in a
different way.
gdb/ChangeLog
2019-12-01 Tom Tromey <tom@tromey.com>
* NEWS: Document new settings.
* tui/tui-wingeneral.c (box_win): Apply appropriate border style.
* tui/tui-win.c (_initialize_tui_win): Add border style
observers.
* tui/tui-io.h (tui_apply_style): Declare.
* tui/tui-io.c (tui_apply_style): Rename from apply_style. No
longer static.
(apply_ansi_escape, tui_set_reverse_mode): Update.
* cli/cli-style.h (class cli_style_option) <add_setshow_commands>:
Add "skip_intensity" parameter.
<changed>: New member.
<do_set_value>: Declare.
(tui_border_style, tui_active_border_style): Declare.
* cli/cli-style.c (tui_border_style, tui_active_border_style): New
globals.
(cli_style_option): Initialize "changed".
(cli_style_option::do_set_value): New function.
(cli_style_option::add_setshow_commands): Add "skip_intensity"
parameter. Update.
(STYLE_ADD_SETSHOW_COMMANDS): Add "SKIP" parameter.
(_initialize_cli_style): Update. Create TUI border style
commands.
gdb/doc/ChangeLog
2019-12-01 Tom Tromey <tom@tromey.com>
* gdb.texinfo (TUI Configuration): Mention TUI border styles.
(Output Styling): Document new settings.
Change-Id: Id13e2af0af2a0bde61282752f2c379db3220c9fc
Diffstat (limited to 'gdb/tui')
-rw-r--r-- | gdb/tui/tui-io.c | 8 | ||||
-rw-r--r-- | gdb/tui/tui-io.h | 3 | ||||
-rw-r--r-- | gdb/tui/tui-win.c | 4 | ||||
-rw-r--r-- | gdb/tui/tui-wingeneral.c | 8 |
4 files changed, 19 insertions, 4 deletions
diff --git a/gdb/tui/tui-io.c b/gdb/tui/tui-io.c index 964f2e3..2eef288 100644 --- a/gdb/tui/tui-io.c +++ b/gdb/tui/tui-io.c @@ -306,8 +306,8 @@ get_color_pair (int fg, int bg) /* Apply STYLE to W. */ -static void -apply_style (WINDOW *w, ui_file_style style) +void +tui_apply_style (WINDOW *w, ui_file_style style) { /* Reset. */ wattron (w, A_NORMAL); @@ -413,7 +413,7 @@ apply_ansi_escape (WINDOW *w, const char *buf) style.set_reverse (true); } - apply_style (w, style); + tui_apply_style (w, style); return n_read; } @@ -438,7 +438,7 @@ tui_set_reverse_mode (WINDOW *w, bool reverse) style.set_fg (reverse_save_fg); } - apply_style (w, style); + tui_apply_style (w, style); } /* Print LENGTH characters from the buffer pointed to by BUF to the diff --git a/gdb/tui/tui-io.h b/gdb/tui/tui-io.h index ec23787..01bfe45 100644 --- a/gdb/tui/tui-io.h +++ b/gdb/tui/tui-io.h @@ -51,6 +51,9 @@ extern gdb::unique_xmalloc_ptr<char> tui_expand_tabs (const char *); /* Enter/leave reverse video mode. */ extern void tui_set_reverse_mode (WINDOW *w, bool reverse); +/* Apply STYLE to the window. */ +extern void tui_apply_style (WINDOW *w, ui_file_style style); + extern struct ui_out *tui_out; extern cli_ui_out *tui_old_uiout; diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c index 576f9a5..b6204be 100644 --- a/gdb/tui/tui-win.c +++ b/gdb/tui/tui-win.c @@ -30,6 +30,7 @@ #include "breakpoint.h" #include "frame.h" #include "cli/cli-cmds.h" +#include "cli/cli-style.h" #include "top.h" #include "source.h" #include "event-loop.h" @@ -1517,4 +1518,7 @@ in a compact form. The compact form puts the source closer to\n\ the line numbers and uses less horizontal space."), tui_set_compact_source, tui_show_compact_source, &tui_setlist, &tui_showlist); + + tui_border_style.changed.attach (tui_rehighlight_all); + tui_active_border_style.changed.attach (tui_rehighlight_all); } diff --git a/gdb/tui/tui-wingeneral.c b/gdb/tui/tui-wingeneral.c index f6a6903..b92f203 100644 --- a/gdb/tui/tui-wingeneral.c +++ b/gdb/tui/tui-wingeneral.c @@ -22,9 +22,11 @@ #include "defs.h" #include "tui/tui.h" #include "tui/tui-data.h" +#include "tui/tui-io.h" #include "tui/tui-wingeneral.h" #include "tui/tui-win.h" #include "tui/tui-stack.h" +#include "cli/cli-style.h" #include "gdb_curses.h" @@ -51,6 +53,11 @@ box_win (struct tui_win_info *win_info, else attrs = tui_border_attrs; + /* tui_apply_style resets the style entirely, so be sure to call it + before applying ATTRS. */ + tui_apply_style (win, (highlight_flag + ? tui_active_border_style.style () + : tui_border_style.style ())); wattron (win, attrs); #ifdef HAVE_WBORDER wborder (win, tui_border_vline, tui_border_vline, @@ -77,6 +84,7 @@ box_win (struct tui_win_info *win_info, } } wattroff (win, attrs); + tui_apply_style (win, ui_file_style ()); } |