Improve/fix the TUI's current source line highlight
authorPedro Alves <palves@redhat.com>
Mon, 18 Mar 2019 14:26:00 +0000 (14:26 +0000)
committerPedro Alves <palves@redhat.com>
Mon, 18 Mar 2019 14:26:00 +0000 (14:26 +0000)
commit55c10aca2e93cc7a4301aa1635ef9d6d73a804b1
treef688304ed81cfb3aa05ef6735c7d89cf046b1177
parent647bb750c298bbee618aa4448a30dcf9adf23602
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.
gdb/ChangeLog
gdb/tui/tui-io.c
gdb/tui/tui-io.h
gdb/tui/tui-winsource.c
gdb/ui-style.h
This page took 0.039663 seconds and 4 git commands to generate.