aboutsummaryrefslogtreecommitdiff
path: root/gdb/tui/tui-winsource.c
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/tui/tui-winsource.c
parent647bb750c298bbee618aa4448a30dcf9adf23602 (diff)
downloadbinutils-55c10aca2e93cc7a4301aa1635ef9d6d73a804b1.zip
binutils-55c10aca2e93cc7a4301aa1635ef9d6d73a804b1.tar.gz
binutils-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/tui/tui-winsource.c')
-rw-r--r--gdb/tui/tui-winsource.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c
index 9925b79..e31a016 100644
--- a/gdb/tui/tui-winsource.c
+++ b/gdb/tui/tui-winsource.c
@@ -277,13 +277,13 @@ tui_show_source_line (struct tui_win_info *win_info, int lineno)
line = win_info->generic.content[lineno - 1];
if (line->which_element.source.is_exec_point)
- wattron (win_info->generic.handle, A_STANDOUT);
+ tui_set_reverse_mode (win_info->generic.handle, true);
wmove (win_info->generic.handle, lineno, 1);
tui_puts (line->which_element.source.line,
win_info->generic.handle);
if (line->which_element.source.is_exec_point)
- wattroff (win_info->generic.handle, A_STANDOUT);
+ tui_set_reverse_mode (win_info->generic.handle, false);
/* Clear to end of line but stop before the border. */
x = getcurx (win_info->generic.handle);