1 /* TUI window generic functions.
3 Copyright (C) 1998-2019 Free Software Foundation, Inc.
5 Contributed by Hewlett-Packard Company.
7 This file is part of GDB.
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
22 /* This module contains procedures for handling tui window functions
23 like resize, scrolling, scrolling, changing focus, etc.
25 Author: Susan B. Macchia */
30 #include "breakpoint.h"
32 #include "cli/cli-cmds.h"
33 #include "cli/cli-style.h"
36 #include "event-loop.h"
40 #include "tui/tui-io.h"
41 #include "tui/tui-command.h"
42 #include "tui/tui-data.h"
43 #include "tui/tui-layout.h"
44 #include "tui/tui-wingeneral.h"
45 #include "tui/tui-stack.h"
46 #include "tui/tui-regs.h"
47 #include "tui/tui-disasm.h"
48 #include "tui/tui-source.h"
49 #include "tui/tui-winsource.h"
50 #include "tui/tui-win.h"
52 #include "gdb_curses.h"
54 #include "readline/readline.h"
55 #include "gdbsupport/gdb_string_view.h"
59 static void tui_set_tab_width_command (const char *, int);
60 static void tui_refresh_all_command (const char *, int);
61 static void tui_all_windows_info (const char *, int);
62 static void tui_scroll_forward_command (const char *, int);
63 static void tui_scroll_backward_command (const char *, int);
64 static void tui_scroll_left_command (const char *, int);
65 static void tui_scroll_right_command (const char *, int);
66 static void parse_scrolling_args (const char *,
67 struct tui_win_info
**,
71 #define WIN_HEIGHT_USAGE "Usage: winheight WINDOW-NAME [+ | -] NUM-LINES\n"
72 #define FOCUS_USAGE "Usage: focus [WINDOW-NAME | next | prev]\n"
75 # define ACS_LRCORNER '+'
78 # define ACS_LLCORNER '+'
81 # define ACS_ULCORNER '+'
84 # define ACS_URCORNER '+'
87 # define ACS_HLINE '-'
90 # define ACS_VLINE '|'
93 /* Possible values for tui-border-kind variable. */
94 static const char *const tui_border_kind_enums
[] = {
101 /* Possible values for tui-border-mode and tui-active-border-mode. */
102 static const char *const tui_border_mode_enums
[] = {
119 /* Translation table for border-mode variables.
120 The list of values must be terminated by a NULL.
121 After the NULL value, an entry defines the default. */
122 struct tui_translate tui_border_mode_translate
[] = {
123 { "normal", A_NORMAL
},
124 { "standout", A_STANDOUT
},
125 { "reverse", A_REVERSE
},
127 { "half-standout", A_DIM
| A_STANDOUT
},
129 { "bold-standout", A_BOLD
| A_STANDOUT
},
131 { "normal", A_NORMAL
}
134 /* Translation tables for border-kind, one for each border
135 character (see wborder, border curses operations).
136 -1 is used to indicate the ACS because ACS characters
137 are determined at run time by curses (depends on terminal). */
138 struct tui_translate tui_border_kind_translate_vline
[] = {
146 struct tui_translate tui_border_kind_translate_hline
[] = {
154 struct tui_translate tui_border_kind_translate_ulcorner
[] = {
162 struct tui_translate tui_border_kind_translate_urcorner
[] = {
170 struct tui_translate tui_border_kind_translate_llcorner
[] = {
178 struct tui_translate tui_border_kind_translate_lrcorner
[] = {
187 /* Tui configuration variables controlled with set/show command. */
188 const char *tui_active_border_mode
= "bold-standout";
190 show_tui_active_border_mode (struct ui_file
*file
,
192 struct cmd_list_element
*c
,
195 fprintf_filtered (file
, _("\
196 The attribute mode to use for the active TUI window border is \"%s\".\n"),
200 const char *tui_border_mode
= "normal";
202 show_tui_border_mode (struct ui_file
*file
,
204 struct cmd_list_element
*c
,
207 fprintf_filtered (file
, _("\
208 The attribute mode to use for the TUI window borders is \"%s\".\n"),
212 const char *tui_border_kind
= "acs";
214 show_tui_border_kind (struct ui_file
*file
,
216 struct cmd_list_element
*c
,
219 fprintf_filtered (file
, _("The kind of border for TUI windows is \"%s\".\n"),
224 /* Tui internal configuration variables. These variables are updated
225 by tui_update_variables to reflect the tui configuration
227 chtype tui_border_vline
;
228 chtype tui_border_hline
;
229 chtype tui_border_ulcorner
;
230 chtype tui_border_urcorner
;
231 chtype tui_border_llcorner
;
232 chtype tui_border_lrcorner
;
234 int tui_border_attrs
;
235 int tui_active_border_attrs
;
237 /* Identify the item in the translation table.
238 When the item is not recognized, use the default entry. */
239 static struct tui_translate
*
240 translate (const char *name
, struct tui_translate
*table
)
244 if (name
&& strcmp (table
->name
, name
) == 0)
249 /* Not found, return default entry. */
254 /* Update the tui internal configuration according to gdb settings.
255 Returns 1 if the configuration has changed and the screen should
258 tui_update_variables (void)
261 struct tui_translate
*entry
;
263 entry
= translate (tui_border_mode
, tui_border_mode_translate
);
264 if (tui_border_attrs
!= entry
->value
)
266 tui_border_attrs
= entry
->value
;
269 entry
= translate (tui_active_border_mode
, tui_border_mode_translate
);
270 if (tui_active_border_attrs
!= entry
->value
)
272 tui_active_border_attrs
= entry
->value
;
276 /* If one corner changes, all characters are changed.
277 Only check the first one. The ACS characters are determined at
278 run time by curses terminal management. */
279 entry
= translate (tui_border_kind
, tui_border_kind_translate_lrcorner
);
280 if (tui_border_lrcorner
!= (chtype
) entry
->value
)
282 tui_border_lrcorner
= (entry
->value
< 0) ? ACS_LRCORNER
: entry
->value
;
285 entry
= translate (tui_border_kind
, tui_border_kind_translate_llcorner
);
286 tui_border_llcorner
= (entry
->value
< 0) ? ACS_LLCORNER
: entry
->value
;
288 entry
= translate (tui_border_kind
, tui_border_kind_translate_ulcorner
);
289 tui_border_ulcorner
= (entry
->value
< 0) ? ACS_ULCORNER
: entry
->value
;
291 entry
= translate (tui_border_kind
, tui_border_kind_translate_urcorner
);
292 tui_border_urcorner
= (entry
->value
< 0) ? ACS_URCORNER
: entry
->value
;
294 entry
= translate (tui_border_kind
, tui_border_kind_translate_hline
);
295 tui_border_hline
= (entry
->value
< 0) ? ACS_HLINE
: entry
->value
;
297 entry
= translate (tui_border_kind
, tui_border_kind_translate_vline
);
298 tui_border_vline
= (entry
->value
< 0) ? ACS_VLINE
: entry
->value
;
304 set_tui_cmd (const char *args
, int from_tty
)
309 show_tui_cmd (const char *args
, int from_tty
)
313 static struct cmd_list_element
*tuilist
;
316 tui_command (const char *args
, int from_tty
)
318 printf_unfiltered (_("\"tui\" must be followed by the name of a "
320 help_list (tuilist
, "tui ", all_commands
, gdb_stdout
);
323 struct cmd_list_element
**
324 tui_get_cmd_list (void)
327 add_prefix_cmd ("tui", class_tui
, tui_command
,
328 _("Text User Interface commands."),
329 &tuilist
, "tui ", 0, &cmdlist
);
333 /* The set_func hook of "set tui ..." commands that affect the window
334 borders on the TUI display. */
337 tui_set_var_cmd (const char *null_args
,
338 int from_tty
, struct cmd_list_element
*c
)
340 if (tui_update_variables () && tui_active
)
341 tui_rehighlight_all ();
346 /* True if TUI resizes should print a message. This is used by the
349 static bool resize_message
;
352 show_tui_resize_message (struct ui_file
*file
, int from_tty
,
353 struct cmd_list_element
*c
, const char *value
)
355 fprintf_filtered (file
, _("TUI resize messaging is %s.\n"), value
);
360 /* Generic window name completion function. Complete window name pointed
361 to by TEXT and WORD. If INCLUDE_NEXT_PREV_P is true then the special
362 window names 'next' and 'prev' will also be considered as possible
363 completions of the window name. */
366 window_name_completer (completion_tracker
&tracker
,
367 int include_next_prev_p
,
368 const char *text
, const char *word
)
370 std::vector
<const char *> completion_name_vec
;
372 for (tui_win_info
*win_info
: all_tui_windows ())
374 const char *completion_name
= NULL
;
376 /* We can't focus on an invisible window. */
377 if (!win_info
->is_visible ())
380 completion_name
= win_info
->name ();
381 gdb_assert (completion_name
!= NULL
);
382 completion_name_vec
.push_back (completion_name
);
385 /* If no windows are considered visible then the TUI has not yet been
386 initialized. But still "focus src" and "focus cmd" will work because
387 invoking the focus command will entail initializing the TUI which sets the
388 default layout to SRC_COMMAND. */
389 if (completion_name_vec
.empty ())
391 completion_name_vec
.push_back (SRC_NAME
);
392 completion_name_vec
.push_back (CMD_NAME
);
395 if (include_next_prev_p
)
397 completion_name_vec
.push_back ("next");
398 completion_name_vec
.push_back ("prev");
402 completion_name_vec
.push_back (NULL
);
403 complete_on_enum (tracker
, completion_name_vec
.data (), text
, word
);
406 /* Complete possible window names to focus on. TEXT is the complete text
407 entered so far, WORD is the word currently being completed. */
410 focus_completer (struct cmd_list_element
*ignore
,
411 completion_tracker
&tracker
,
412 const char *text
, const char *word
)
414 window_name_completer (tracker
, 1, text
, word
);
417 /* Complete possible window names for winheight command. TEXT is the
418 complete text entered so far, WORD is the word currently being
422 winheight_completer (struct cmd_list_element
*ignore
,
423 completion_tracker
&tracker
,
424 const char *text
, const char *word
)
426 /* The first word is the window name. That we can complete. Subsequent
427 words can't be completed. */
431 window_name_completer (tracker
, 0, text
, word
);
434 /* Update gdb's knowledge of the terminal size. */
436 tui_update_gdb_sizes (void)
442 width
= TUI_CMD_WIN
->width
;
443 height
= TUI_CMD_WIN
->height
;
447 width
= tui_term_width ();
448 height
= tui_term_height ();
451 set_screen_width_and_height (width
, height
);
455 /* Set the logical focus to win_info. */
457 tui_set_win_focus_to (struct tui_win_info
*win_info
)
459 if (win_info
!= NULL
)
461 struct tui_win_info
*win_with_focus
= tui_win_with_focus ();
463 tui_unhighlight_win (win_with_focus
);
464 tui_set_win_with_focus (win_info
);
465 tui_highlight_win (win_info
);
471 tui_win_info::forward_scroll (int num_to_scroll
)
473 if (num_to_scroll
== 0)
474 num_to_scroll
= height
- 3;
476 do_scroll_vertical (num_to_scroll
);
480 tui_win_info::backward_scroll (int num_to_scroll
)
482 if (num_to_scroll
== 0)
483 num_to_scroll
= height
- 3;
485 do_scroll_vertical (-num_to_scroll
);
490 tui_win_info::left_scroll (int num_to_scroll
)
492 if (num_to_scroll
== 0)
495 do_scroll_horizontal (num_to_scroll
);
500 tui_win_info::right_scroll (int num_to_scroll
)
502 if (num_to_scroll
== 0)
505 do_scroll_horizontal (-num_to_scroll
);
510 tui_refresh_all_win (void)
512 clearok (curscr
, TRUE
);
517 tui_rehighlight_all (void)
519 for (tui_win_info
*win_info
: all_tui_windows ())
520 win_info
->check_and_display_highlight_if_needed ();
523 /* Resize all the windows based on the terminal size. This function
524 gets called from within the readline SIGWINCH handler. */
526 tui_resize_all (void)
528 int height_diff
, width_diff
;
529 int screenheight
, screenwidth
;
531 rl_get_screen_size (&screenheight
, &screenwidth
);
532 width_diff
= screenwidth
- tui_term_width ();
533 height_diff
= screenheight
- tui_term_height ();
534 if (height_diff
|| width_diff
)
536 struct tui_win_info
*win_with_focus
= tui_win_with_focus ();
538 #ifdef HAVE_RESIZE_TERM
539 resize_term (screenheight
, screenwidth
);
541 /* Turn keypad off while we resize. */
542 if (win_with_focus
!= TUI_CMD_WIN
)
543 keypad (TUI_CMD_WIN
->handle
.get (), FALSE
);
544 tui_update_gdb_sizes ();
545 tui_set_term_height_to (screenheight
);
546 tui_set_term_width_to (screenwidth
);
548 /* erase + clearok are used instead of a straightforward clear as
549 AIX 5.3 does not define clear. */
551 clearok (curscr
, TRUE
);
552 tui_apply_current_layout ();
553 tui_delete_invisible_windows ();
554 /* Turn keypad back on, unless focus is in the command
556 if (win_with_focus
!= TUI_CMD_WIN
)
557 keypad (TUI_CMD_WIN
->handle
.get (), TRUE
);
562 /* Token for use by TUI's asynchronous SIGWINCH handler. */
563 static struct async_signal_handler
*tui_sigwinch_token
;
565 /* TUI's SIGWINCH signal handler. */
567 tui_sigwinch_handler (int signal
)
569 mark_async_signal_handler (tui_sigwinch_token
);
570 tui_set_win_resized_to (true);
573 /* Callback for asynchronously resizing TUI following a SIGWINCH signal. */
575 tui_async_resize_screen (gdb_client_data arg
)
577 rl_resize_terminal ();
581 int screen_height
, screen_width
;
583 rl_get_screen_size (&screen_height
, &screen_width
);
584 set_screen_width_and_height (screen_width
, screen_height
);
586 /* win_resized is left set so that the next call to tui_enable()
587 resizes the TUI windows. */
591 tui_set_win_resized_to (false);
593 tui_refresh_all_win ();
594 tui_update_gdb_sizes ();
598 printf_unfiltered ("@@ resize done %d, size = %dx%d\n", count
,
599 tui_term_width (), tui_term_height ());
602 tui_redisplay_readline ();
607 /* Initialize TUI's SIGWINCH signal handler. Note that the handler is not
608 uninstalled when we exit TUI, so the handler should not assume that TUI is
611 tui_initialize_win (void)
615 = create_async_signal_handler (tui_async_resize_screen
, NULL
);
618 #ifdef HAVE_SIGACTION
619 struct sigaction old_winch
;
621 memset (&old_winch
, 0, sizeof (old_winch
));
622 old_winch
.sa_handler
= &tui_sigwinch_handler
;
624 old_winch
.sa_flags
= SA_RESTART
;
626 sigaction (SIGWINCH
, &old_winch
, NULL
);
628 signal (SIGWINCH
, &tui_sigwinch_handler
);
636 tui_scroll_forward_command (const char *arg
, int from_tty
)
638 int num_to_scroll
= 1;
639 struct tui_win_info
*win_to_scroll
;
641 /* Make sure the curses mode is enabled. */
644 parse_scrolling_args (arg
, &win_to_scroll
, NULL
);
646 parse_scrolling_args (arg
, &win_to_scroll
, &num_to_scroll
);
647 win_to_scroll
->forward_scroll (num_to_scroll
);
652 tui_scroll_backward_command (const char *arg
, int from_tty
)
654 int num_to_scroll
= 1;
655 struct tui_win_info
*win_to_scroll
;
657 /* Make sure the curses mode is enabled. */
660 parse_scrolling_args (arg
, &win_to_scroll
, NULL
);
662 parse_scrolling_args (arg
, &win_to_scroll
, &num_to_scroll
);
663 win_to_scroll
->backward_scroll (num_to_scroll
);
668 tui_scroll_left_command (const char *arg
, int from_tty
)
671 struct tui_win_info
*win_to_scroll
;
673 /* Make sure the curses mode is enabled. */
675 parse_scrolling_args (arg
, &win_to_scroll
, &num_to_scroll
);
676 win_to_scroll
->left_scroll (num_to_scroll
);
681 tui_scroll_right_command (const char *arg
, int from_tty
)
684 struct tui_win_info
*win_to_scroll
;
686 /* Make sure the curses mode is enabled. */
688 parse_scrolling_args (arg
, &win_to_scroll
, &num_to_scroll
);
689 win_to_scroll
->right_scroll (num_to_scroll
);
693 /* Answer the window represented by name. */
694 static struct tui_win_info
*
695 tui_partial_win_by_name (gdb::string_view name
)
699 for (tui_win_info
*item
: all_tui_windows ())
701 const char *cur_name
= item
->name ();
703 if (startswith (cur_name
, name
))
711 /* Set focus to the window named by 'arg'. */
713 tui_set_focus_command (const char *arg
, int from_tty
)
719 struct tui_win_info
*win_info
= NULL
;
721 if (subset_compare (arg
, "next"))
722 win_info
= tui_next_win (tui_win_with_focus ());
723 else if (subset_compare (arg
, "prev"))
724 win_info
= tui_prev_win (tui_win_with_focus ());
726 win_info
= tui_partial_win_by_name (arg
);
728 if (win_info
== NULL
)
729 error (_("Unrecognized window name \"%s\""), arg
);
730 if (!win_info
->is_visible ())
731 error (_("Window \"%s\" is not visible"), arg
);
733 tui_set_win_focus_to (win_info
);
734 keypad (TUI_CMD_WIN
->handle
.get (), win_info
!= TUI_CMD_WIN
);
735 printf_filtered (_("Focus set to %s window.\n"),
736 tui_win_with_focus ()->name ());
739 error (_("Incorrect Number of Arguments.\n%s"), FOCUS_USAGE
);
743 tui_all_windows_info (const char *arg
, int from_tty
)
747 printf_filtered (_("The TUI is not active.\n"));
751 struct tui_win_info
*win_with_focus
= tui_win_with_focus ();
752 struct ui_out
*uiout
= current_uiout
;
754 ui_out_emit_table
table_emitter (uiout
, 3, -1, "tui-windows");
755 uiout
->table_header (10, ui_left
, "name", "Name");
756 uiout
->table_header (5, ui_right
, "lines", "Lines");
757 uiout
->table_header (10, ui_left
, "focus", "Focus");
758 uiout
->table_body ();
760 for (tui_win_info
*win_info
: all_tui_windows ())
761 if (win_info
->is_visible ())
763 ui_out_emit_tuple
tuple_emitter (uiout
, nullptr);
765 uiout
->field_string ("name", win_info
->name ());
766 uiout
->field_signed ("lines", win_info
->height
);
767 if (win_with_focus
== win_info
)
768 uiout
->field_string ("focus", _("(has focus)"));
770 uiout
->field_skip ("focus");
777 tui_refresh_all_command (const char *arg
, int from_tty
)
779 /* Make sure the curses mode is enabled. */
782 tui_refresh_all_win ();
785 /* The tab width that should be used by the TUI. */
787 unsigned int tui_tab_width
= DEFAULT_TAB_LEN
;
789 /* The tab width as set by the user. */
791 static unsigned int internal_tab_width
= DEFAULT_TAB_LEN
;
793 /* After the tab width is set, call this to update the relevant
799 for (tui_win_info
*win_info
: all_tui_windows ())
801 if (win_info
->is_visible ())
802 win_info
->update_tab_width ();
806 /* Callback for "set tui tab-width". */
809 tui_set_tab_width (const char *ignore
,
810 int from_tty
, struct cmd_list_element
*c
)
812 if (internal_tab_width
== 0)
814 internal_tab_width
= tui_tab_width
;
815 error (_("Tab width must not be 0"));
818 tui_tab_width
= internal_tab_width
;
822 /* Callback for "show tui tab-width". */
825 tui_show_tab_width (struct ui_file
*file
, int from_tty
,
826 struct cmd_list_element
*c
, const char *value
)
828 fprintf_filtered (gdb_stdout
, _("TUI tab width is %s spaces.\n"), value
);
834 bool compact_source
= false;
836 /* Callback for "set tui compact-source". */
839 tui_set_compact_source (const char *ignore
, int from_tty
,
840 struct cmd_list_element
*c
)
842 if (TUI_SRC_WIN
!= nullptr)
843 TUI_SRC_WIN
->refill ();
846 /* Callback for "show tui compact-source". */
849 tui_show_compact_source (struct ui_file
*file
, int from_tty
,
850 struct cmd_list_element
*c
, const char *value
)
852 printf_filtered (_("TUI source window compactness is %s.\n"), value
);
855 /* Set the tab width of the specified window. */
857 tui_set_tab_width_command (const char *arg
, int from_tty
)
859 /* Make sure the curses mode is enabled. */
867 warning (_("Tab widths greater than 0 must be specified."));
870 internal_tab_width
= ts
;
879 /* Set the height of the specified window. */
881 tui_set_win_height_command (const char *arg
, int from_tty
)
883 /* Make sure the curses mode is enabled. */
887 const char *buf
= arg
;
888 const char *buf_ptr
= buf
;
890 struct tui_win_info
*win_info
;
892 buf_ptr
= strchr (buf_ptr
, ' ');
895 /* Validate the window name. */
896 gdb::string_view
wname (buf
, buf_ptr
- buf
);
897 win_info
= tui_partial_win_by_name (wname
);
899 if (win_info
== NULL
)
900 error (_("Unrecognized window name \"%s\""), arg
);
901 if (!win_info
->is_visible ())
902 error (_("Window \"%s\" is not visible"), arg
);
904 /* Process the size. */
905 buf_ptr
= skip_spaces (buf_ptr
);
907 if (*buf_ptr
!= '\0')
910 bool fixed_size
= true;
913 if (*buf_ptr
== '+' || *buf_ptr
== '-')
920 input_no
= atoi (buf_ptr
);
926 new_height
= input_no
;
928 new_height
= win_info
->height
+ input_no
;
930 /* Now change the window's height, and adjust
931 all other windows around it. */
932 tui_adjust_window_height (win_info
, new_height
);
933 tui_update_gdb_sizes ();
936 warning (_("Invalid window height specified.\n%s"),
941 printf_filtered (WIN_HEIGHT_USAGE
);
944 printf_filtered (WIN_HEIGHT_USAGE
);
947 /* See tui-data.h. */
950 tui_win_info::max_height () const
952 return tui_term_height () - 2;
956 parse_scrolling_args (const char *arg
,
957 struct tui_win_info
**win_to_scroll
,
962 *win_to_scroll
= tui_win_with_focus ();
964 /* First set up the default window to scroll, in case there is no
970 /* Process the number of lines to scroll. */
971 std::string copy
= arg
;
973 if (isdigit (*buf_ptr
))
978 buf_ptr
= strchr (buf_ptr
, ' ');
983 *num_to_scroll
= atoi (num_str
);
986 else if (num_to_scroll
)
987 *num_to_scroll
= atoi (num_str
);
990 /* Process the window name if one is specified. */
995 wname
= skip_spaces (buf_ptr
);
999 *win_to_scroll
= tui_partial_win_by_name (wname
);
1001 if (*win_to_scroll
== NULL
)
1002 error (_("Unrecognized window `%s'"), wname
);
1003 if (!(*win_to_scroll
)->is_visible ())
1004 error (_("Window is not visible"));
1005 else if (*win_to_scroll
== TUI_CMD_WIN
)
1006 *win_to_scroll
= *(tui_source_windows ().begin ());
1012 /* Function to initialize gdb commands, for tui window
1016 _initialize_tui_win (void)
1018 static struct cmd_list_element
*tui_setlist
;
1019 static struct cmd_list_element
*tui_showlist
;
1020 struct cmd_list_element
*cmd
;
1022 /* Define the classes of commands.
1023 They will appear in the help list in the reverse of this order. */
1024 add_prefix_cmd ("tui", class_tui
, set_tui_cmd
,
1025 _("TUI configuration variables."),
1026 &tui_setlist
, "set tui ",
1027 0 /* allow-unknown */, &setlist
);
1028 add_prefix_cmd ("tui", class_tui
, show_tui_cmd
,
1029 _("TUI configuration variables."),
1030 &tui_showlist
, "show tui ",
1031 0 /* allow-unknown */, &showlist
);
1033 add_com ("refresh", class_tui
, tui_refresh_all_command
,
1034 _("Refresh the terminal display."));
1036 cmd
= add_com ("tabset", class_tui
, tui_set_tab_width_command
, _("\
1037 Set the width (in characters) of tab stops.\n\
1039 deprecate_cmd (cmd
, "set tui tab-width");
1041 cmd
= add_com ("winheight", class_tui
, tui_set_win_height_command
, _("\
1042 Set or modify the height of a specified window.\n"
1044 "Window names are:\n\
1045 src : the source window\n\
1046 cmd : the command window\n\
1047 asm : the disassembly window\n\
1048 regs : the register display"));
1049 add_com_alias ("wh", "winheight", class_tui
, 0);
1050 set_cmd_completer (cmd
, winheight_completer
);
1051 add_info ("win", tui_all_windows_info
,
1052 _("List of all displayed windows."));
1053 cmd
= add_com ("focus", class_tui
, tui_set_focus_command
, _("\
1054 Set focus to named window or next/prev window.\n"
1056 "Valid Window names are:\n\
1057 src : the source window\n\
1058 asm : the disassembly window\n\
1059 regs : the register display\n\
1060 cmd : the command window"));
1061 add_com_alias ("fs", "focus", class_tui
, 0);
1062 set_cmd_completer (cmd
, focus_completer
);
1063 add_com ("+", class_tui
, tui_scroll_forward_command
, _("\
1064 Scroll window forward.\n\
1065 Usage: + [WIN] [N]"));
1066 add_com ("-", class_tui
, tui_scroll_backward_command
, _("\
1067 Scroll window backward.\n\
1068 Usage: - [WIN] [N]"));
1069 add_com ("<", class_tui
, tui_scroll_left_command
, _("\
1070 Scroll window text to the left.\n\
1071 Usage: < [WIN] [N]"));
1072 add_com (">", class_tui
, tui_scroll_right_command
, _("\
1073 Scroll window text to the right.\n\
1074 Usage: > [WIN] [N]"));
1076 /* Define the tui control variables. */
1077 add_setshow_enum_cmd ("border-kind", no_class
, tui_border_kind_enums
,
1078 &tui_border_kind
, _("\
1079 Set the kind of border for TUI windows."), _("\
1080 Show the kind of border for TUI windows."), _("\
1081 This variable controls the border of TUI windows:\n\
1082 space use a white space\n\
1083 ascii use ascii characters + - | for the border\n\
1084 acs use the Alternate Character Set"),
1086 show_tui_border_kind
,
1087 &tui_setlist
, &tui_showlist
);
1089 add_setshow_enum_cmd ("border-mode", no_class
, tui_border_mode_enums
,
1090 &tui_border_mode
, _("\
1091 Set the attribute mode to use for the TUI window borders."), _("\
1092 Show the attribute mode to use for the TUI window borders."), _("\
1093 This variable controls the attributes to use for the window borders:\n\
1094 normal normal display\n\
1095 standout use highlight mode of terminal\n\
1096 reverse use reverse video mode\n\
1097 half use half bright\n\
1098 half-standout use half bright and standout mode\n\
1099 bold use extra bright or bold\n\
1100 bold-standout use extra bright or bold with standout mode"),
1102 show_tui_border_mode
,
1103 &tui_setlist
, &tui_showlist
);
1105 add_setshow_enum_cmd ("active-border-mode", no_class
, tui_border_mode_enums
,
1106 &tui_active_border_mode
, _("\
1107 Set the attribute mode to use for the active TUI window border."), _("\
1108 Show the attribute mode to use for the active TUI window border."), _("\
1109 This variable controls the attributes to use for the active window border:\n\
1110 normal normal display\n\
1111 standout use highlight mode of terminal\n\
1112 reverse use reverse video mode\n\
1113 half use half bright\n\
1114 half-standout use half bright and standout mode\n\
1115 bold use extra bright or bold\n\
1116 bold-standout use extra bright or bold with standout mode"),
1118 show_tui_active_border_mode
,
1119 &tui_setlist
, &tui_showlist
);
1121 add_setshow_zuinteger_cmd ("tab-width", no_class
,
1122 &internal_tab_width
, _("\
1123 Set the tab width, in characters, for the TUI."), _("\
1124 Show the tab witdh, in characters, for the TUI."), _("\
1125 This variable controls how many spaces are used to display a tab character."),
1126 tui_set_tab_width
, tui_show_tab_width
,
1127 &tui_setlist
, &tui_showlist
);
1129 add_setshow_boolean_cmd ("tui-resize-message", class_maintenance
,
1130 &resize_message
, _("\
1131 Set TUI resize messaging."), _("\
1132 Show TUI resize messaging."), _("\
1133 When enabled GDB will print a message when the terminal is resized."),
1135 show_tui_resize_message
,
1136 &maintenance_set_cmdlist
,
1137 &maintenance_show_cmdlist
);
1139 add_setshow_boolean_cmd ("compact-source", class_tui
,
1140 &compact_source
, _("\
1141 Set whether the TUI source window is compact."), _("\
1142 Show whether the TUI source window is compact."), _("\
1143 This variable controls whether the TUI source window is shown\n\
1144 in a compact form. The compact form puts the source closer to\n\
1145 the line numbers and uses less horizontal space."),
1146 tui_set_compact_source
, tui_show_compact_source
,
1147 &tui_setlist
, &tui_showlist
);
1149 tui_border_style
.changed
.attach (tui_rehighlight_all
);
1150 tui_active_border_style
.changed
.attach (tui_rehighlight_all
);