@@ -30302,6 +30302,12 @@ Use extra bright or bold mode.
Use extra bright or bold and standout mode.
@end table
+@item set tui status-window-mode @var{mode}
+@kindex set tui status-window-mode
+Select the display attributes for the contents of the status window.
+The @var{mode} is as for @code{set tui border-mode} and
+@code{set tui border-active-mode}. The default is standout mode.
+
@item set tui tab-width @var{nchars}
@kindex set tui tab-width
@kindex tabset
@@ -106,3 +106,16 @@ Term::check_contents "split layout contents" \
Term::check_box "source box in split layout" 0 0 80 8
Term::check_box "asm box in split layout" 0 7 80 8
+
+set re_noattr "\[^<\]"
+
+set status_window_line 15
+
+set status [Term::get_line_with_attrs $status_window_line]
+gdb_assert { [regexp "^<reverse:1>$re_noattr*<reverse:0>$" $status] == 1} \
+ "status window: reverse"
+
+Term::command "set tui status-window-mode normal"
+
+set status [Term::get_line_with_attrs $status_window_line]
+gdb_assert { [regexp "^$re_noattr*$" $status] == 1} "status window: normal"
@@ -547,6 +547,18 @@ namespace eval Term {
}
}
+ # Reset the attributes in attributes array UPVAR_NAME to the default values.
+ proc reset_attrs { upvar_name } {
+ upvar $upvar_name var
+ array set var {
+ intensity normal
+ fg default
+ bg default
+ underline 0
+ reverse 0
+ }
+ }
+
# Select Graphic Rendition.
#
# https://vt100.net/docs/vt510-rm/SGR.html
@@ -557,11 +569,7 @@ namespace eval Term {
foreach item $args {
switch -exact -- $item {
"" - 0 {
- set _attrs(intensity) normal
- set _attrs(fg) default
- set _attrs(bg) default
- set _attrs(underline) 0
- set _attrs(reverse) 0
+ reset_attrs _attrs
}
1 {
set _attrs(intensity) bold
@@ -666,13 +674,7 @@ namespace eval Term {
set _cur_col 0
set _cur_row 0
set _resize_count 0
- array set _attrs {
- intensity normal
- fg default
- bg default
- underline 0
- reverse 0
- }
+ reset_attrs _attrs
_clear_lines 0 $_rows
}
@@ -873,10 +875,25 @@ namespace eval Term {
wait_for "^$str"
}
- # Return the text of screen line N, without attributes. Lines are
- # 0-based. If C is given, stop before column C. Columns are also
- # zero-based.
- proc get_line {n {c ""}} {
+ # Apply the attribute list in ATTRS to attributes array UPVAR_NAME.
+ # Return a string annotating the changed attributes.
+ proc apply_attrs { upvar_name attrs } {
+ set res ""
+ upvar $upvar_name var
+ foreach { attr val } $attrs {
+ if { $var($attr) != $val } {
+ append res "<$attr:$val>"
+ set var($attr) $val
+ }
+ }
+
+ return $res
+ }
+
+ # Return the text of screen line N. Lines are 0-based. If C is given,
+ # stop before column C. Columns are also zero-based. If ATTRS, annotate
+ # with attributes.
+ proc get_line_1 {n c attrs} {
variable _rows
# This can happen during resizing, if the cursor seems to
# temporarily be off-screen.
@@ -889,13 +906,37 @@ namespace eval Term {
variable _chars
set c [_default $c $_cols]
set x 0
+ if { $attrs } {
+ reset_attrs line_attrs
+ }
while {$x < $c} {
+ if { $attrs } {
+ set char_attrs [lindex $_chars($x,$n) 1]
+ append result [apply_attrs line_attrs $char_attrs]
+ }
append result [lindex $_chars($x,$n) 0]
incr x
}
+ if { $attrs } {
+ reset_attrs zero_attrs
+ set char_attrs [array get zero_attrs]
+ append result [apply_attrs line_attrs $char_attrs]
+ }
return $result
}
+ # Return the text of screen line N, without attributes. Lines are
+ # 0-based. If C is given, stop before column C. Columns are also
+ # zero-based.
+ proc get_line {n {c ""} } {
+ return [get_line_1 $n $c 0]
+ }
+
+ # As get_line, but annotate with attributes.
+ proc get_line_with_attrs {n {c ""}} {
+ return [get_line_1 $n $c 1]
+ }
+
# Get just the character at (X, Y).
proc get_char {x y} {
variable _chars
@@ -1069,8 +1110,8 @@ namespace eval Term {
}
# A debugging function to dump the current screen, with line
- # numbers.
- proc dump_screen {} {
+ # numbers. If ATTRS, annotate with attributes.
+ proc dump_screen { {attrs 0} } {
variable _rows
variable _cols
variable _cur_row
@@ -1080,10 +1121,15 @@ namespace eval Term {
for {set y 0} {$y < $_rows} {incr y} {
set fmt [format %5d $y]
- verbose -log "$fmt [get_line $y]"
+ verbose -log "$fmt [get_line_1 $y "" $attrs]"
}
}
+ # As dump_screen, but with attributes annotation.
+ proc dump_screen_with_attrs {} {
+ return [dump_screen 1]
+ }
+
# A debugging function to dump a box from the current screen, with line
# numbers.
proc dump_box { x y width height } {
@@ -37,6 +37,7 @@
#include "tui/tui-winsource.h"
#include "tui/tui-file.h"
#include "tui/tui-location.h"
+#include "tui/tui-win.h"
#include "gdb_curses.h"
@@ -234,15 +235,10 @@ tui_locator_window::rerender ()
std::string string = make_status_line ();
scrollok (handle.get (), FALSE);
wmove (handle.get (), 0, 0);
- /* We ignore the return value from wstandout and wstandend, casting them
- to void in order to avoid a compiler warning. The warning itself was
- introduced by a patch to ncurses 5.7 dated 2009-08-29, changing these
- macro to expand to code that causes the compiler to generate an
- unused-value warning. */
- (void) wstandout (handle.get ());
+ wattron (handle.get (), tui_status_window_attrs);
waddstr (handle.get (), string.c_str ());
wclrtoeol (handle.get ());
- (void) wstandend (handle.get ());
+ wattroff (handle.get (), tui_status_window_attrs);
refresh_window ();
wmove (handle.get (), 0, 0);
}
@@ -346,6 +346,42 @@ tui_set_var_cmd (const char *null_args,
tui_rehighlight_all ();
}
+/* Value of "tui status-window-mode". */
+
+static const char *tui_status_window_mode = "standout";
+
+/* See tui-win.h. */
+
+int tui_status_window_attrs;
+
+/* Show value of "tui status-window-mode". */
+
+static void
+show_tui_status_window_mode (struct ui_file *file,
+ int from_tty,
+ struct cmd_list_element *c,
+ const char *value)
+{
+ gdb_printf (file, _("\
+The attribute mode to use for the TUI status window is \"%s\".\n"),
+ value);
+}
+
+/* Set value of "tui status-window-mode". */
+
+static void
+set_tui_status_window_mode (const char *null_args,
+ int from_tty, struct cmd_list_element *c)
+{
+ struct tui_translate *entry
+ = translate (tui_status_window_mode, tui_border_mode_translate);
+ if (tui_status_window_attrs == entry->value)
+ return;
+
+ tui_status_window_attrs = entry->value;
+ if (tui_active)
+ tui_show_locator_content ();
+}
/* True if TUI resizes should print a message. This is used by the
@@ -1251,6 +1287,22 @@ This variable controls the attributes to use for the active window border:\n\
show_tui_active_border_mode,
&tui_setlist, &tui_showlist);
+ add_setshow_enum_cmd ("status-window-mode", no_class, tui_border_mode_enums,
+ &tui_status_window_mode, _("\
+Set the attribute mode to use for the TUI status window."), _("\
+Show the attribute mode to use for the TUI status window."), _("\
+This variable controls the attributes to use for the status window:\n\
+ normal normal display\n\
+ standout use highlight mode of terminal\n\
+ reverse use reverse video mode\n\
+ half use half bright\n\
+ half-standout use half bright and standout mode\n\
+ bold use extra bright or bold\n\
+ bold-standout use extra bright or bold with standout mode"),
+ set_tui_status_window_mode,
+ show_tui_status_window_mode,
+ &tui_setlist, &tui_showlist);
+
add_setshow_zuinteger_cmd ("tab-width", no_class,
&internal_tab_width, _("\
Set the tab width, in characters, for the TUI."), _("\
@@ -1305,4 +1357,8 @@ When enabled, the left margin will use '_' and '0' instead of spaces."),
tui_border_style.changed.attach (tui_rehighlight_all, "tui-win");
tui_active_border_style.changed.attach (tui_rehighlight_all, "tui-win");
+
+ /* Assign default value. */
+ tui_status_window_attrs
+ = translate (tui_status_window_mode, tui_border_mode_translate)->value;
}
@@ -38,6 +38,9 @@ extern chtype tui_border_hline;
extern int tui_border_attrs;
extern int tui_active_border_attrs;
+/* Attributes for the contents of the status window. */
+extern int tui_status_window_attrs;
+
extern bool tui_update_variables ();
extern void tui_initialize_win (void);