1 /* TUI window generic functions.
3 Copyright (C) 1998-2020 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 "gdbsupport/event-loop.h"
38 #include "async-event.h"
41 #include "tui/tui-io.h"
42 #include "tui/tui-command.h"
43 #include "tui/tui-data.h"
44 #include "tui/tui-layout.h"
45 #include "tui/tui-wingeneral.h"
46 #include "tui/tui-stack.h"
47 #include "tui/tui-regs.h"
48 #include "tui/tui-disasm.h"
49 #include "tui/tui-source.h"
50 #include "tui/tui-winsource.h"
51 #include "tui/tui-win.h"
53 #include "gdb_curses.h"
55 #include "readline/readline.h"
56 #include "gdbsupport/gdb_string_view.h"
60 static void tui_set_tab_width_command (const char *, int);
61 static void tui_refresh_all_command (const char *, int);
62 static void tui_all_windows_info (const char *, int);
63 static void tui_scroll_forward_command (const char *, int);
64 static void tui_scroll_backward_command (const char *, int);
65 static void tui_scroll_left_command (const char *, int);
66 static void tui_scroll_right_command (const char *, int);
67 static void parse_scrolling_args (const char *,
68 struct tui_win_info
**,
73 # define ACS_LRCORNER '+'
76 # define ACS_LLCORNER '+'
79 # define ACS_ULCORNER '+'
82 # define ACS_URCORNER '+'
85 # define ACS_HLINE '-'
88 # define ACS_VLINE '|'
91 /* Possible values for tui-border-kind variable. */
92 static const char *const tui_border_kind_enums
[] = {
99 /* Possible values for tui-border-mode and tui-active-border-mode. */
100 static const char *const tui_border_mode_enums
[] = {
117 /* Translation table for border-mode variables.
118 The list of values must be terminated by a NULL.
119 After the NULL value, an entry defines the default. */
120 static struct tui_translate tui_border_mode_translate
[] = {
121 { "normal", A_NORMAL
},
122 { "standout", A_STANDOUT
},
123 { "reverse", A_REVERSE
},
125 { "half-standout", A_DIM
| A_STANDOUT
},
127 { "bold-standout", A_BOLD
| A_STANDOUT
},
129 { "normal", A_NORMAL
}
132 /* Translation tables for border-kind, one for each border
133 character (see wborder, border curses operations).
134 -1 is used to indicate the ACS because ACS characters
135 are determined at run time by curses (depends on terminal). */
136 static struct tui_translate tui_border_kind_translate_vline
[] = {
144 static struct tui_translate tui_border_kind_translate_hline
[] = {
152 static struct tui_translate tui_border_kind_translate_ulcorner
[] = {
160 static struct tui_translate tui_border_kind_translate_urcorner
[] = {
168 static struct tui_translate tui_border_kind_translate_llcorner
[] = {
176 static struct tui_translate tui_border_kind_translate_lrcorner
[] = {
185 /* Tui configuration variables controlled with set/show command. */
186 static const char *tui_active_border_mode
= "bold-standout";
188 show_tui_active_border_mode (struct ui_file
*file
,
190 struct cmd_list_element
*c
,
193 fprintf_filtered (file
, _("\
194 The attribute mode to use for the active TUI window border is \"%s\".\n"),
198 static const char *tui_border_mode
= "normal";
200 show_tui_border_mode (struct ui_file
*file
,
202 struct cmd_list_element
*c
,
205 fprintf_filtered (file
, _("\
206 The attribute mode to use for the TUI window borders is \"%s\".\n"),
210 static const char *tui_border_kind
= "acs";
212 show_tui_border_kind (struct ui_file
*file
,
214 struct cmd_list_element
*c
,
217 fprintf_filtered (file
, _("The kind of border for TUI windows is \"%s\".\n"),
222 /* Tui internal configuration variables. These variables are updated
223 by tui_update_variables to reflect the tui configuration
225 chtype tui_border_vline
;
226 chtype tui_border_hline
;
227 chtype tui_border_ulcorner
;
228 chtype tui_border_urcorner
;
229 chtype tui_border_llcorner
;
230 chtype tui_border_lrcorner
;
232 int tui_border_attrs
;
233 int tui_active_border_attrs
;
235 /* Identify the item in the translation table.
236 When the item is not recognized, use the default entry. */
237 static struct tui_translate
*
238 translate (const char *name
, struct tui_translate
*table
)
242 if (name
&& strcmp (table
->name
, name
) == 0)
247 /* Not found, return default entry. */
252 /* Update the tui internal configuration according to gdb settings.
253 Returns 1 if the configuration has changed and the screen should
256 tui_update_variables ()
258 bool need_redraw
= false;
259 struct tui_translate
*entry
;
261 entry
= translate (tui_border_mode
, tui_border_mode_translate
);
262 if (tui_border_attrs
!= entry
->value
)
264 tui_border_attrs
= entry
->value
;
267 entry
= translate (tui_active_border_mode
, tui_border_mode_translate
);
268 if (tui_active_border_attrs
!= entry
->value
)
270 tui_active_border_attrs
= entry
->value
;
274 /* If one corner changes, all characters are changed.
275 Only check the first one. The ACS characters are determined at
276 run time by curses terminal management. */
277 entry
= translate (tui_border_kind
, tui_border_kind_translate_lrcorner
);
278 if (tui_border_lrcorner
!= (chtype
) entry
->value
)
280 tui_border_lrcorner
= (entry
->value
< 0) ? ACS_LRCORNER
: entry
->value
;
283 entry
= translate (tui_border_kind
, tui_border_kind_translate_llcorner
);
284 tui_border_llcorner
= (entry
->value
< 0) ? ACS_LLCORNER
: entry
->value
;
286 entry
= translate (tui_border_kind
, tui_border_kind_translate_ulcorner
);
287 tui_border_ulcorner
= (entry
->value
< 0) ? ACS_ULCORNER
: entry
->value
;
289 entry
= translate (tui_border_kind
, tui_border_kind_translate_urcorner
);
290 tui_border_urcorner
= (entry
->value
< 0) ? ACS_URCORNER
: entry
->value
;
292 entry
= translate (tui_border_kind
, tui_border_kind_translate_hline
);
293 tui_border_hline
= (entry
->value
< 0) ? ACS_HLINE
: entry
->value
;
295 entry
= translate (tui_border_kind
, tui_border_kind_translate_vline
);
296 tui_border_vline
= (entry
->value
< 0) ? ACS_VLINE
: entry
->value
;
302 set_tui_cmd (const char *args
, int from_tty
)
307 show_tui_cmd (const char *args
, int from_tty
)
311 static struct cmd_list_element
*tuilist
;
313 struct cmd_list_element
**
314 tui_get_cmd_list (void)
317 add_basic_prefix_cmd ("tui", class_tui
,
318 _("Text User Interface commands."),
319 &tuilist
, "tui ", 0, &cmdlist
);
323 /* The set_func hook of "set tui ..." commands that affect the window
324 borders on the TUI display. */
327 tui_set_var_cmd (const char *null_args
,
328 int from_tty
, struct cmd_list_element
*c
)
330 if (tui_update_variables () && tui_active
)
331 tui_rehighlight_all ();
336 /* True if TUI resizes should print a message. This is used by the
339 static bool resize_message
;
342 show_tui_resize_message (struct ui_file
*file
, int from_tty
,
343 struct cmd_list_element
*c
, const char *value
)
345 fprintf_filtered (file
, _("TUI resize messaging is %s.\n"), value
);
350 /* Generic window name completion function. Complete window name pointed
351 to by TEXT and WORD. If INCLUDE_NEXT_PREV_P is true then the special
352 window names 'next' and 'prev' will also be considered as possible
353 completions of the window name. */
356 window_name_completer (completion_tracker
&tracker
,
357 int include_next_prev_p
,
358 const char *text
, const char *word
)
360 std::vector
<const char *> completion_name_vec
;
362 for (tui_win_info
*win_info
: all_tui_windows ())
364 const char *completion_name
= NULL
;
366 /* We can't focus on an invisible window. */
367 if (!win_info
->is_visible ())
370 completion_name
= win_info
->name ();
371 gdb_assert (completion_name
!= NULL
);
372 completion_name_vec
.push_back (completion_name
);
375 /* If no windows are considered visible then the TUI has not yet been
376 initialized. But still "focus src" and "focus cmd" will work because
377 invoking the focus command will entail initializing the TUI which sets the
378 default layout to "src". */
379 if (completion_name_vec
.empty ())
381 completion_name_vec
.push_back (SRC_NAME
);
382 completion_name_vec
.push_back (CMD_NAME
);
385 if (include_next_prev_p
)
387 completion_name_vec
.push_back ("next");
388 completion_name_vec
.push_back ("prev");
392 completion_name_vec
.push_back (NULL
);
393 complete_on_enum (tracker
, completion_name_vec
.data (), text
, word
);
396 /* Complete possible window names to focus on. TEXT is the complete text
397 entered so far, WORD is the word currently being completed. */
400 focus_completer (struct cmd_list_element
*ignore
,
401 completion_tracker
&tracker
,
402 const char *text
, const char *word
)
404 window_name_completer (tracker
, 1, text
, word
);
407 /* Complete possible window names for winheight command. TEXT is the
408 complete text entered so far, WORD is the word currently being
412 winheight_completer (struct cmd_list_element
*ignore
,
413 completion_tracker
&tracker
,
414 const char *text
, const char *word
)
416 /* The first word is the window name. That we can complete. Subsequent
417 words can't be completed. */
421 window_name_completer (tracker
, 0, text
, word
);
424 /* Update gdb's knowledge of the terminal size. */
426 tui_update_gdb_sizes (void)
432 width
= TUI_CMD_WIN
->width
;
433 height
= TUI_CMD_WIN
->height
;
437 width
= tui_term_width ();
438 height
= tui_term_height ();
441 set_screen_width_and_height (width
, height
);
446 tui_win_info::forward_scroll (int num_to_scroll
)
448 if (num_to_scroll
== 0)
449 num_to_scroll
= height
- 3;
451 do_scroll_vertical (num_to_scroll
);
455 tui_win_info::backward_scroll (int num_to_scroll
)
457 if (num_to_scroll
== 0)
458 num_to_scroll
= height
- 3;
460 do_scroll_vertical (-num_to_scroll
);
465 tui_win_info::left_scroll (int num_to_scroll
)
467 if (num_to_scroll
== 0)
470 do_scroll_horizontal (num_to_scroll
);
475 tui_win_info::right_scroll (int num_to_scroll
)
477 if (num_to_scroll
== 0)
480 do_scroll_horizontal (-num_to_scroll
);
485 tui_refresh_all_win (void)
487 clearok (curscr
, TRUE
);
492 tui_rehighlight_all (void)
494 for (tui_win_info
*win_info
: all_tui_windows ())
495 win_info
->check_and_display_highlight_if_needed ();
498 /* Resize all the windows based on the terminal size. This function
499 gets called from within the readline SIGWINCH handler. */
501 tui_resize_all (void)
503 int height_diff
, width_diff
;
504 int screenheight
, screenwidth
;
506 rl_get_screen_size (&screenheight
, &screenwidth
);
507 width_diff
= screenwidth
- tui_term_width ();
508 height_diff
= screenheight
- tui_term_height ();
509 if (height_diff
|| width_diff
)
511 struct tui_win_info
*win_with_focus
= tui_win_with_focus ();
513 #ifdef HAVE_RESIZE_TERM
514 resize_term (screenheight
, screenwidth
);
516 /* Turn keypad off while we resize. */
517 if (win_with_focus
!= TUI_CMD_WIN
)
518 keypad (TUI_CMD_WIN
->handle
.get (), FALSE
);
519 tui_update_gdb_sizes ();
520 tui_set_term_height_to (screenheight
);
521 tui_set_term_width_to (screenwidth
);
523 /* erase + clearok are used instead of a straightforward clear as
524 AIX 5.3 does not define clear. */
526 clearok (curscr
, TRUE
);
527 tui_apply_current_layout ();
528 /* Turn keypad back on, unless focus is in the command
530 if (win_with_focus
!= TUI_CMD_WIN
)
531 keypad (TUI_CMD_WIN
->handle
.get (), TRUE
);
536 /* Token for use by TUI's asynchronous SIGWINCH handler. */
537 static struct async_signal_handler
*tui_sigwinch_token
;
539 /* TUI's SIGWINCH signal handler. */
541 tui_sigwinch_handler (int signal
)
543 mark_async_signal_handler (tui_sigwinch_token
);
544 tui_set_win_resized_to (true);
547 /* Callback for asynchronously resizing TUI following a SIGWINCH signal. */
549 tui_async_resize_screen (gdb_client_data arg
)
551 rl_resize_terminal ();
555 int screen_height
, screen_width
;
557 rl_get_screen_size (&screen_height
, &screen_width
);
558 set_screen_width_and_height (screen_width
, screen_height
);
560 /* win_resized is left set so that the next call to tui_enable()
561 resizes the TUI windows. */
565 tui_set_win_resized_to (false);
567 tui_refresh_all_win ();
568 tui_update_gdb_sizes ();
572 printf_unfiltered ("@@ resize done %d, size = %dx%d\n", count
,
573 tui_term_width (), tui_term_height ());
576 tui_redisplay_readline ();
581 /* Initialize TUI's SIGWINCH signal handler. Note that the handler is not
582 uninstalled when we exit TUI, so the handler should not assume that TUI is
585 tui_initialize_win (void)
589 = create_async_signal_handler (tui_async_resize_screen
, NULL
);
592 #ifdef HAVE_SIGACTION
593 struct sigaction old_winch
;
595 memset (&old_winch
, 0, sizeof (old_winch
));
596 old_winch
.sa_handler
= &tui_sigwinch_handler
;
598 old_winch
.sa_flags
= SA_RESTART
;
600 sigaction (SIGWINCH
, &old_winch
, NULL
);
602 signal (SIGWINCH
, &tui_sigwinch_handler
);
610 tui_scroll_forward_command (const char *arg
, int from_tty
)
612 int num_to_scroll
= 1;
613 struct tui_win_info
*win_to_scroll
;
615 /* Make sure the curses mode is enabled. */
618 parse_scrolling_args (arg
, &win_to_scroll
, NULL
);
620 parse_scrolling_args (arg
, &win_to_scroll
, &num_to_scroll
);
621 win_to_scroll
->forward_scroll (num_to_scroll
);
626 tui_scroll_backward_command (const char *arg
, int from_tty
)
628 int num_to_scroll
= 1;
629 struct tui_win_info
*win_to_scroll
;
631 /* Make sure the curses mode is enabled. */
634 parse_scrolling_args (arg
, &win_to_scroll
, NULL
);
636 parse_scrolling_args (arg
, &win_to_scroll
, &num_to_scroll
);
637 win_to_scroll
->backward_scroll (num_to_scroll
);
642 tui_scroll_left_command (const char *arg
, int from_tty
)
645 struct tui_win_info
*win_to_scroll
;
647 /* Make sure the curses mode is enabled. */
649 parse_scrolling_args (arg
, &win_to_scroll
, &num_to_scroll
);
650 win_to_scroll
->left_scroll (num_to_scroll
);
655 tui_scroll_right_command (const char *arg
, int from_tty
)
658 struct tui_win_info
*win_to_scroll
;
660 /* Make sure the curses mode is enabled. */
662 parse_scrolling_args (arg
, &win_to_scroll
, &num_to_scroll
);
663 win_to_scroll
->right_scroll (num_to_scroll
);
667 /* Answer the window represented by name. */
668 static struct tui_win_info
*
669 tui_partial_win_by_name (gdb::string_view name
)
671 struct tui_win_info
*best
= nullptr;
675 for (tui_win_info
*item
: all_tui_windows ())
677 const char *cur_name
= item
->name ();
679 if (name
== cur_name
)
681 if (startswith (cur_name
, name
))
684 error (_("Window name \"%*s\" is ambiguous"),
685 (int) name
.size (), name
.data ());
694 /* Set focus to the window named by 'arg'. */
696 tui_set_focus_command (const char *arg
, int from_tty
)
701 error_no_arg (_("name of window to focus"));
703 struct tui_win_info
*win_info
= NULL
;
705 if (subset_compare (arg
, "next"))
706 win_info
= tui_next_win (tui_win_with_focus ());
707 else if (subset_compare (arg
, "prev"))
708 win_info
= tui_prev_win (tui_win_with_focus ());
710 win_info
= tui_partial_win_by_name (arg
);
712 if (win_info
== NULL
)
713 error (_("Unrecognized window name \"%s\""), arg
);
714 if (!win_info
->is_visible ())
715 error (_("Window \"%s\" is not visible"), arg
);
717 tui_set_win_focus_to (win_info
);
718 keypad (TUI_CMD_WIN
->handle
.get (), win_info
!= TUI_CMD_WIN
);
719 printf_filtered (_("Focus set to %s window.\n"),
720 tui_win_with_focus ()->name ());
724 tui_all_windows_info (const char *arg
, int from_tty
)
728 printf_filtered (_("The TUI is not active.\n"));
732 struct tui_win_info
*win_with_focus
= tui_win_with_focus ();
733 struct ui_out
*uiout
= current_uiout
;
735 ui_out_emit_table
table_emitter (uiout
, 3, -1, "tui-windows");
736 uiout
->table_header (10, ui_left
, "name", "Name");
737 uiout
->table_header (5, ui_right
, "lines", "Lines");
738 uiout
->table_header (10, ui_left
, "focus", "Focus");
739 uiout
->table_body ();
741 for (tui_win_info
*win_info
: all_tui_windows ())
742 if (win_info
->is_visible ())
744 ui_out_emit_tuple
tuple_emitter (uiout
, nullptr);
746 uiout
->field_string ("name", win_info
->name ());
747 uiout
->field_signed ("lines", win_info
->height
);
748 if (win_with_focus
== win_info
)
749 uiout
->field_string ("focus", _("(has focus)"));
751 uiout
->field_skip ("focus");
758 tui_refresh_all_command (const char *arg
, int from_tty
)
760 /* Make sure the curses mode is enabled. */
763 tui_refresh_all_win ();
766 /* The tab width that should be used by the TUI. */
768 unsigned int tui_tab_width
= DEFAULT_TAB_LEN
;
770 /* The tab width as set by the user. */
772 static unsigned int internal_tab_width
= DEFAULT_TAB_LEN
;
774 /* After the tab width is set, call this to update the relevant
780 for (tui_win_info
*win_info
: all_tui_windows ())
782 if (win_info
->is_visible ())
783 win_info
->update_tab_width ();
787 /* Callback for "set tui tab-width". */
790 tui_set_tab_width (const char *ignore
,
791 int from_tty
, struct cmd_list_element
*c
)
793 if (internal_tab_width
== 0)
795 internal_tab_width
= tui_tab_width
;
796 error (_("Tab width must not be 0"));
799 tui_tab_width
= internal_tab_width
;
803 /* Callback for "show tui tab-width". */
806 tui_show_tab_width (struct ui_file
*file
, int from_tty
,
807 struct cmd_list_element
*c
, const char *value
)
809 fprintf_filtered (gdb_stdout
, _("TUI tab width is %s spaces.\n"), value
);
815 bool compact_source
= false;
817 /* Callback for "set tui compact-source". */
820 tui_set_compact_source (const char *ignore
, int from_tty
,
821 struct cmd_list_element
*c
)
823 if (TUI_SRC_WIN
!= nullptr)
824 TUI_SRC_WIN
->refill ();
827 /* Callback for "show tui compact-source". */
830 tui_show_compact_source (struct ui_file
*file
, int from_tty
,
831 struct cmd_list_element
*c
, const char *value
)
833 printf_filtered (_("TUI source window compactness is %s.\n"), value
);
836 /* Set the tab width of the specified window. */
838 tui_set_tab_width_command (const char *arg
, int from_tty
)
840 /* Make sure the curses mode is enabled. */
848 warning (_("Tab widths greater than 0 must be specified."));
851 internal_tab_width
= ts
;
860 /* Set the height of the specified window. */
862 tui_set_win_height_command (const char *arg
, int from_tty
)
864 /* Make sure the curses mode is enabled. */
867 error_no_arg (_("name of window"));
869 const char *buf
= arg
;
870 const char *buf_ptr
= buf
;
872 struct tui_win_info
*win_info
;
874 buf_ptr
= skip_to_space (buf_ptr
);
876 /* Validate the window name. */
877 gdb::string_view
wname (buf
, buf_ptr
- buf
);
878 win_info
= tui_partial_win_by_name (wname
);
880 if (win_info
== NULL
)
881 error (_("Unrecognized window name \"%s\""), arg
);
882 if (!win_info
->is_visible ())
883 error (_("Window \"%s\" is not visible"), arg
);
885 /* Process the size. */
886 buf_ptr
= skip_spaces (buf_ptr
);
888 if (*buf_ptr
!= '\0')
891 bool fixed_size
= true;
894 if (*buf_ptr
== '+' || *buf_ptr
== '-')
901 input_no
= atoi (buf_ptr
);
907 new_height
= input_no
;
909 new_height
= win_info
->height
+ input_no
;
911 /* Now change the window's height, and adjust
912 all other windows around it. */
913 tui_adjust_window_height (win_info
, new_height
);
914 tui_update_gdb_sizes ();
917 error (_("Invalid window height specified"));
921 /* See tui-data.h. */
924 tui_win_info::max_height () const
926 return tui_term_height () - 2;
929 /* See tui-data.h. */
932 tui_gen_win_info::max_width () const
934 return tui_term_width () - 2;
938 parse_scrolling_args (const char *arg
,
939 struct tui_win_info
**win_to_scroll
,
944 *win_to_scroll
= tui_win_with_focus ();
946 /* First set up the default window to scroll, in case there is no
952 /* Process the number of lines to scroll. */
953 std::string copy
= arg
;
955 if (isdigit (*buf_ptr
))
960 buf_ptr
= strchr (buf_ptr
, ' ');
965 *num_to_scroll
= atoi (num_str
);
968 else if (num_to_scroll
)
969 *num_to_scroll
= atoi (num_str
);
972 /* Process the window name if one is specified. */
977 wname
= skip_spaces (buf_ptr
);
981 *win_to_scroll
= tui_partial_win_by_name (wname
);
983 if (*win_to_scroll
== NULL
)
984 error (_("Unrecognized window `%s'"), wname
);
985 if (!(*win_to_scroll
)->is_visible ())
986 error (_("Window is not visible"));
987 else if (*win_to_scroll
== TUI_CMD_WIN
)
988 *win_to_scroll
= *(tui_source_windows ().begin ());
994 /* Function to initialize gdb commands, for tui window
997 void _initialize_tui_win ();
999 _initialize_tui_win ()
1001 static struct cmd_list_element
*tui_setlist
;
1002 static struct cmd_list_element
*tui_showlist
;
1003 struct cmd_list_element
*cmd
;
1005 /* Define the classes of commands.
1006 They will appear in the help list in the reverse of this order. */
1007 add_prefix_cmd ("tui", class_tui
, set_tui_cmd
,
1008 _("TUI configuration variables."),
1009 &tui_setlist
, "set tui ",
1010 0 /* allow-unknown */, &setlist
);
1011 add_prefix_cmd ("tui", class_tui
, show_tui_cmd
,
1012 _("TUI configuration variables."),
1013 &tui_showlist
, "show tui ",
1014 0 /* allow-unknown */, &showlist
);
1016 add_com ("refresh", class_tui
, tui_refresh_all_command
,
1017 _("Refresh the terminal display."));
1019 cmd
= add_com ("tabset", class_tui
, tui_set_tab_width_command
, _("\
1020 Set the width (in characters) of tab stops.\n\
1022 deprecate_cmd (cmd
, "set tui tab-width");
1024 cmd
= add_com ("winheight", class_tui
, tui_set_win_height_command
, _("\
1025 Set or modify the height of a specified window.\n\
1026 Usage: winheight WINDOW-NAME [+ | -] NUM-LINES\n\
1027 Use \"info win\" to see the names of the windows currently being displayed."));
1028 add_com_alias ("wh", "winheight", class_tui
, 0);
1029 set_cmd_completer (cmd
, winheight_completer
);
1030 add_info ("win", tui_all_windows_info
,
1031 _("List of all displayed windows.\n\
1033 cmd
= add_com ("focus", class_tui
, tui_set_focus_command
, _("\
1034 Set focus to named window or next/prev window.\n\
1035 Usage: focus [WINDOW-NAME | next | prev]\n\
1036 Use \"info win\" to see the names of the windows currently being displayed."));
1037 add_com_alias ("fs", "focus", class_tui
, 0);
1038 set_cmd_completer (cmd
, focus_completer
);
1039 add_com ("+", class_tui
, tui_scroll_forward_command
, _("\
1040 Scroll window forward.\n\
1041 Usage: + [N] [WIN]\n\
1042 Scroll window WIN N lines forwards. Both WIN and N are optional, N\n\
1043 defaults to 1, and WIN defaults to the currently focused window."));
1044 add_com ("-", class_tui
, tui_scroll_backward_command
, _("\
1045 Scroll window backward.\n\
1046 Usage: - [N] [WIN]\n\
1047 Scroll window WIN N lines backwards. Both WIN and N are optional, N\n\
1048 defaults to 1, and WIN defaults to the currently focused window."));
1049 add_com ("<", class_tui
, tui_scroll_left_command
, _("\
1050 Scroll window text to the left.\n\
1051 Usage: < [N] [WIN]\n\
1052 Scroll window WIN N characters left. Both WIN and N are optional, N\n\
1053 defaults to 1, and WIN defaults to the currently focused window."));
1054 add_com (">", class_tui
, tui_scroll_right_command
, _("\
1055 Scroll window text to the right.\n\
1056 Usage: > [N] [WIN]\n\
1057 Scroll window WIN N characters right. Both WIN and N are optional, N\n\
1058 defaults to 1, and WIN defaults to the currently focused window."));
1060 /* Define the tui control variables. */
1061 add_setshow_enum_cmd ("border-kind", no_class
, tui_border_kind_enums
,
1062 &tui_border_kind
, _("\
1063 Set the kind of border for TUI windows."), _("\
1064 Show the kind of border for TUI windows."), _("\
1065 This variable controls the border of TUI windows:\n\
1066 space use a white space\n\
1067 ascii use ascii characters + - | for the border\n\
1068 acs use the Alternate Character Set"),
1070 show_tui_border_kind
,
1071 &tui_setlist
, &tui_showlist
);
1073 add_setshow_enum_cmd ("border-mode", no_class
, tui_border_mode_enums
,
1074 &tui_border_mode
, _("\
1075 Set the attribute mode to use for the TUI window borders."), _("\
1076 Show the attribute mode to use for the TUI window borders."), _("\
1077 This variable controls the attributes to use for the window borders:\n\
1078 normal normal display\n\
1079 standout use highlight mode of terminal\n\
1080 reverse use reverse video mode\n\
1081 half use half bright\n\
1082 half-standout use half bright and standout mode\n\
1083 bold use extra bright or bold\n\
1084 bold-standout use extra bright or bold with standout mode"),
1086 show_tui_border_mode
,
1087 &tui_setlist
, &tui_showlist
);
1089 add_setshow_enum_cmd ("active-border-mode", no_class
, tui_border_mode_enums
,
1090 &tui_active_border_mode
, _("\
1091 Set the attribute mode to use for the active TUI window border."), _("\
1092 Show the attribute mode to use for the active TUI window border."), _("\
1093 This variable controls the attributes to use for the active window border:\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_active_border_mode
,
1103 &tui_setlist
, &tui_showlist
);
1105 add_setshow_zuinteger_cmd ("tab-width", no_class
,
1106 &internal_tab_width
, _("\
1107 Set the tab width, in characters, for the TUI."), _("\
1108 Show the tab witdh, in characters, for the TUI."), _("\
1109 This variable controls how many spaces are used to display a tab character."),
1110 tui_set_tab_width
, tui_show_tab_width
,
1111 &tui_setlist
, &tui_showlist
);
1113 add_setshow_boolean_cmd ("tui-resize-message", class_maintenance
,
1114 &resize_message
, _("\
1115 Set TUI resize messaging."), _("\
1116 Show TUI resize messaging."), _("\
1117 When enabled GDB will print a message when the terminal is resized."),
1119 show_tui_resize_message
,
1120 &maintenance_set_cmdlist
,
1121 &maintenance_show_cmdlist
);
1123 add_setshow_boolean_cmd ("compact-source", class_tui
,
1124 &compact_source
, _("\
1125 Set whether the TUI source window is compact."), _("\
1126 Show whether the TUI source window is compact."), _("\
1127 This variable controls whether the TUI source window is shown\n\
1128 in a compact form. The compact form puts the source closer to\n\
1129 the line numbers and uses less horizontal space."),
1130 tui_set_compact_source
, tui_show_compact_source
,
1131 &tui_setlist
, &tui_showlist
);
1133 tui_border_style
.changed
.attach (tui_rehighlight_all
);
1134 tui_active_border_style
.changed
.attach (tui_rehighlight_all
);