36#include "gdbsupport/event-loop.h"
55#include "readline/readline.h"
56#include "gdbsupport/gdb_string_view.h"
73# define ACS_LRCORNER '+'
76# define ACS_LLCORNER '+'
79# define ACS_ULCORNER '+'
82# define ACS_URCORNER '+'
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 }
194The attribute mode to use for the active TUI window border is \"%s\".\n"),
206The attribute mode to use for the TUI window borders is \"%s\".\n"),
217 gdb_printf (file, _(
"The kind of border for TUI windows is \"%s\".\n"),
232Styling the text highlighted by the TUI's current position indicator is %s.\n"),
282 bool need_redraw =
false;
332 _(
"Text User Interface commands."),
371 int include_next_prev_p,
372 const char *text,
const char *word)
374 std::vector<const char *> completion_name_vec;
378 const char *completion_name = NULL;
381 if (!win_info->is_visible ())
384 completion_name = win_info->name ();
385 gdb_assert (completion_name != NULL);
386 completion_name_vec.push_back (completion_name);
393 if (completion_name_vec.empty ())
395 completion_name_vec.push_back (
SRC_NAME);
396 completion_name_vec.push_back (
CMD_NAME);
399 if (include_next_prev_p)
401 completion_name_vec.push_back (
"next");
402 completion_name_vec.push_back (
"prev");
406 completion_name_vec.push_back (NULL);
416 const char *text,
const char *word)
428 const char *text,
const char *word)
462 if (num_to_scroll == 0)
463 num_to_scroll =
height - 3;
471 if (num_to_scroll == 0)
472 num_to_scroll =
height - 3;
481 if (num_to_scroll == 0)
491 if (num_to_scroll == 0)
501 clearok (curscr, TRUE);
509 win_info->check_and_display_highlight_if_needed ();
517 int height_diff, width_diff;
518 int screenheight, screenwidth;
520 rl_get_screen_size (&screenheight, &screenwidth);
523 if (height_diff || width_diff)
525#ifdef HAVE_RESIZE_TERM
526 resize_term (screenheight, screenwidth);
537 clearok (curscr, TRUE);
552tui_sigwinch_handler (
int signal)
560tui_async_resize_screen (gdb_client_data arg)
562 rl_resize_terminal ();
566 int screen_height, screen_width;
568 rl_get_screen_size (&screen_height, &screen_width);
605 struct sigaction old_winch;
607 memset (&old_winch, 0,
sizeof (old_winch));
608 old_winch.sa_handler = &tui_sigwinch_handler;
610 old_winch.sa_flags = SA_RESTART;
612 sigaction (SIGWINCH, &old_winch, NULL);
614 signal (SIGWINCH, &tui_sigwinch_handler);
624 int num_to_scroll = 1;
640 int num_to_scroll = 1;
687 const char *cur_name = item->
name ();
689 if (
name == cur_name)
691 if (startswith (cur_name,
name))
694 error (_(
"Window name \"%*s\" is ambiguous"),
714 if (startswith (
"next", arg))
716 else if (startswith (
"prev", arg))
721 if (win_info == NULL)
722 error (_(
"Unrecognized window name \"%s\""), arg);
724 error (_(
"Window \"%s\" is not visible"), arg);
751 if (win_info->is_visible ())
776#define DEFAULT_TAB_LEN 8
794 if (win_info->is_visible ())
795 win_info->update_tab_width ();
808 error (_(
"Tab width must not be 0"));
860 warning (_(
"Tab widths greater than 0 must be specified."));
892 const char *buf = arg;
893 const char *buf_ptr = buf;
897 buf_ptr = skip_to_space (buf_ptr);
900 gdb::string_view wname (buf, buf_ptr - buf);
903 if (win_info == NULL)
904 error (_(
"Unrecognized window name \"%s\""), arg);
906 error (_(
"Window \"%s\" is not visible"), arg);
909 buf_ptr = skip_spaces (buf_ptr);
911 if (*buf_ptr !=
'\0')
914 bool fixed_size =
true;
917 if (*buf_ptr ==
'+' || *buf_ptr ==
'-')
924 input_no = atoi (buf_ptr);
935 curr_size = win_info->
width;
937 curr_size = win_info->
height;
938 new_size = curr_size + input_no;
952 error (_(
"Invalid window width specified"));
954 error (_(
"Invalid window height specified"));
1009 std::string copy = arg;
1011 if (isdigit (*buf_ptr))
1016 buf_ptr = strchr (buf_ptr,
' ');
1017 if (buf_ptr != NULL)
1021 *num_to_scroll = atoi (num_str);
1024 else if (num_to_scroll)
1025 *num_to_scroll = atoi (num_str);
1029 if (buf_ptr != NULL)
1033 wname = skip_spaces (buf_ptr);
1039 if (*win_to_scroll == NULL)
1040 error (_(
"Unrecognized window `%s'"), wname);
1041 if (!(*win_to_scroll)->is_visible ())
1042 error (_(
"Window is not visible"));
1075 _(
"TUI configuration variables."),
1076 _(
"TUI configuration variables."),
1077 &tui_setlist, &tui_showlist,
1082 _(
"Refresh the terminal display."),
1088Set the width (in characters) of tab stops.\n\
1094 _(
"Text User Interface window commands."),
1099Set or modify the height of a specified window.\n\
1100Usage: tui window height WINDOW-NAME [+ | -] NUM-LINES\n\
1101Use \"info win\" to see the names of the windows currently being displayed."),
1109Set or modify the width of a specified window.\n\
1110Usage: tui window width WINDOW-NAME [+ | -] NUM-LINES\n\
1111Use \"info win\" to see the names of the windows currently being displayed."),
1117 _(
"List of all displayed windows.\n\
1121Set focus to named window or next/prev window.\n\
1122Usage: tui focus [WINDOW-NAME | next | prev]\n\
1123Use \"info win\" to see the names of the windows currently being displayed."),
1129Scroll window forward.\n\
1130Usage: + [N] [WIN]\n\
1131Scroll window WIN N lines forwards. Both WIN and N are optional, N\n\
1132defaults to 1, and WIN defaults to the currently focused window."));
1134Scroll window backward.\n\
1135Usage: - [N] [WIN]\n\
1136Scroll window WIN N lines backwards. Both WIN and N are optional, N\n\
1137defaults to 1, and WIN defaults to the currently focused window."));
1139Scroll window text to the left.\n\
1140Usage: < [N] [WIN]\n\
1141Scroll window WIN N characters left. Both WIN and N are optional, N\n\
1142defaults to 1, and WIN defaults to the currently focused window."));
1144Scroll window text to the right.\n\
1145Usage: > [N] [WIN]\n\
1146Scroll window WIN N characters right. Both WIN and N are optional, N\n\
1147defaults to 1, and WIN defaults to the currently focused window."));
1152Set the kind of border for TUI windows."), _(
"\
1153Show the kind of border for TUI windows."), _(
"\
1154This variable controls the border of TUI windows:\n\
1155 space use a white space\n\
1156 ascii use ascii characters + - | for the border\n\
1157 acs use the Alternate Character Set"),
1160 &tui_setlist, &tui_showlist);
1164Set the attribute mode to use for the TUI window borders."), _(
"\
1165Show the attribute mode to use for the TUI window borders."), _(
"\
1166This variable controls the attributes to use for the window borders:\n\
1167 normal normal display\n\
1168 standout use highlight mode of terminal\n\
1169 reverse use reverse video mode\n\
1170 half use half bright\n\
1171 half-standout use half bright and standout mode\n\
1172 bold use extra bright or bold\n\
1173 bold-standout use extra bright or bold with standout mode"),
1176 &tui_setlist, &tui_showlist);
1180Set the attribute mode to use for the active TUI window border."), _(
"\
1181Show the attribute mode to use for the active TUI window border."), _(
"\
1182This variable controls the attributes to use for the active window border:\n\
1183 normal normal display\n\
1184 standout use highlight mode of terminal\n\
1185 reverse use reverse video mode\n\
1186 half use half bright\n\
1187 half-standout use half bright and standout mode\n\
1188 bold use extra bright or bold\n\
1189 bold-standout use extra bright or bold with standout mode"),
1192 &tui_setlist, &tui_showlist);
1196Set the tab width, in characters, for the TUI."), _(
"\
1197Show the tab witdh, in characters, for the TUI."), _(
"\
1198This variable controls how many spaces are used to display a tab character."),
1200 &tui_setlist, &tui_showlist);
1204Set TUI resize messaging."), _(
"\
1205Show TUI resize messaging."), _(
"\
1206When enabled GDB will print a message when the terminal is resized."),
1214Set whether the TUI source window is compact."), _(
"\
1215Show whether the TUI source window is compact."), _(
"\
1216This variable controls whether the TUI source window is shown\n\
1217in a compact form. The compact form puts the source closer to\n\
1218the line numbers and uses less horizontal space."),
1220 &tui_setlist, &tui_showlist);
1224Set whether to style text highlighted by the TUI's current position indicator."),
1226Show whether to style text highlighted by the TUI's current position indicator."),
1228When enabled, the source and assembly code highlighted by the TUI's current\n\
1229position indicator is styled."),
async_signal_handler * create_async_signal_handler(sig_handler_func *proc, gdb_client_data client_data, const char *name)
void mark_async_signal_handler(async_signal_handler *async_handler_ptr)
gdb::observers::observable changed
void field_string(const char *fldname, const char *string, const ui_file_style &style=ui_file_style())
void field_signed(const char *fldname, LONGEST value)
void field_skip(const char *fldname)
void text(const char *string)
void table_header(int width, ui_align align, const std::string &col_name, const std::string &col_hdr)
struct cmd_list_element * showlist
void error_no_arg(const char *why)
struct cmd_list_element * cmdlist
struct cmd_list_element * setlist
struct cmd_list_element * maintenance_show_cmdlist
struct cmd_list_element * maintenance_set_cmdlist
struct cmd_list_element * add_cmd(const char *name, enum command_class theclass, const char *doc, struct cmd_list_element **list)
cmd_list_element * add_com_alias(const char *name, cmd_list_element *target, command_class theclass, int abbrev_flag)
void help_list(struct cmd_list_element *list, const char *cmdtype, enum command_class theclass, struct ui_file *stream)
void set_cmd_completer(struct cmd_list_element *cmd, completer_ftype *completer)
struct cmd_list_element * add_com(const char *name, enum command_class theclass, cmd_simple_func_ftype *fun, const char *doc)
set_show_commands add_setshow_enum_cmd(const char *name, enum command_class theclass, const char *const *enumlist, const char **var, const char *set_doc, const char *show_doc, const char *help_doc, cmd_func_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list)
struct cmd_list_element * deprecate_cmd(struct cmd_list_element *cmd, const char *replacement)
set_show_commands add_setshow_prefix_cmd(const char *name, command_class theclass, const char *set_doc, const char *show_doc, cmd_list_element **set_subcommands_list, cmd_list_element **show_subcommands_list, cmd_list_element **set_list, cmd_list_element **show_list)
struct cmd_list_element * add_prefix_cmd(const char *name, enum command_class theclass, cmd_simple_func_ftype *fun, const char *doc, struct cmd_list_element **subcommands, int allow_unknown, struct cmd_list_element **list)
set_show_commands add_setshow_boolean_cmd(const char *name, enum command_class theclass, bool *var, const char *set_doc, const char *show_doc, const char *help_doc, cmd_func_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list)
void complete_on_enum(completion_tracker &tracker, const char *const *enumlist, const char *text, const char *word)
struct cmd_list_element * add_basic_prefix_cmd(const char *name, enum command_class theclass, const char *doc, struct cmd_list_element **subcommands, int allow_unknown, struct cmd_list_element **list)
struct cmd_list_element * add_info(const char *name, cmd_simple_func_ftype *fun, const char *doc)
set_show_commands add_setshow_zuinteger_cmd(const char *name, enum command_class theclass, unsigned int *var, const char *set_doc, const char *show_doc, const char *help_doc, cmd_func_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list)
cmd_list_element * style_show_list
cmd_list_element * style_set_list
cli_style_option tui_active_border_style
cli_style_option tui_border_style
tui_source_window_iterator begin() const
void right_scroll(int num_to_scroll)
void left_scroll(int num_to_scroll)
void backward_scroll(int num_to_scroll)
virtual void do_scroll_horizontal(int num_to_scroll)=0
virtual const char * name() const =0
void forward_scroll(int num_to_scroll)
virtual void do_scroll_vertical(int num_to_scroll)=0
virtual int max_height() const
void tui_set_win_focus_to(struct tui_win_info *win_info)
int tui_term_height(void)
void tui_set_term_width_to(int w)
struct tui_win_info * tui_prev_win(struct tui_win_info *cur_win)
void tui_set_win_resized_to(bool resized)
static struct tui_win_info * win_with_focus
struct tui_win_info * tui_next_win(struct tui_win_info *cur_win)
void tui_set_term_height_to(int h)
struct tui_win_info * tui_win_with_focus(void)
int tui_term_height(void)
static std::vector< tui_win_info * > & all_tui_windows()
void tui_redisplay_readline(void)
void tui_adjust_window_height(struct tui_win_info *win, int new_height)
void tui_apply_current_layout(bool preserve_cmd_win_size_p)
void tui_adjust_window_width(struct tui_win_info *win, int new_width)
static const char * tui_active_border_mode
void tui_rehighlight_all(void)
struct cmd_list_element ** tui_get_cmd_list(void)
void tui_resize_all(void)
static void set_style_tui_current_position(const char *ignore, int from_tty, cmd_list_element *c)
static const char * tui_border_kind
static void tui_set_tab_width(const char *ignore, int from_tty, struct cmd_list_element *c)
chtype tui_border_ulcorner
static struct tui_translate tui_border_kind_translate_vline[]
static void parse_scrolling_args(const char *, struct tui_win_info **, int *)
static const char *const tui_border_mode_enums[]
static void tui_set_win_width_command(const char *arg, int from_tty)
static void tui_scroll_right_command(const char *, int)
static void focus_completer(struct cmd_list_element *ignore, completion_tracker &tracker, const char *text, const char *word)
static void tui_scroll_left_command(const char *, int)
static void show_tui_border_mode(struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
static struct tui_translate tui_border_kind_translate_urcorner[]
static void tui_show_tab_width(struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
static void tui_scroll_backward_command(const char *, int)
static unsigned int internal_tab_width
bool style_tui_current_position
static const char *const tui_border_kind_enums[]
static void update_tab_width()
static const char * tui_border_mode
chtype tui_border_lrcorner
static struct tui_translate tui_border_kind_translate_hline[]
static bool resize_message
void tui_refresh_all_win(void)
static struct tui_translate tui_border_kind_translate_ulcorner[]
static void tui_set_var_cmd(const char *null_args, int from_tty, struct cmd_list_element *c)
unsigned int tui_tab_width
bool tui_update_variables()
static void tui_all_windows_info(const char *, int)
chtype tui_border_llcorner
static void tui_set_compact_source(const char *ignore, int from_tty, struct cmd_list_element *c)
static struct cmd_list_element * tuilist
int tui_active_border_attrs
static void tui_window_command(const char *args, int from_tty)
static void show_tui_resize_message(struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
static void tui_set_win_height_command(const char *arg, int from_tty)
static cmd_list_element * tui_window_cmds
static void tui_scroll_forward_command(const char *, int)
static struct tui_translate * translate(const char *name, struct tui_translate *table)
static void show_tui_border_kind(struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
static void tui_show_compact_source(struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
static void window_name_completer(completion_tracker &tracker, int include_next_prev_p, const char *text, const char *word)
static void show_tui_active_border_mode(struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
static void show_style_tui_current_position(ui_file *file, int from_tty, cmd_list_element *c, const char *value)
static struct tui_translate tui_border_kind_translate_llcorner[]
void tui_initialize_win(void)
static void tui_set_tab_width_command(const char *, int)
void tui_update_gdb_sizes(void)
chtype tui_border_urcorner
static void tui_refresh_all_command(const char *, int)
static struct tui_translate tui_border_mode_translate[]
static void tui_set_win_size(const char *arg, bool set_width_p)
void _initialize_tui_win()
static void tui_set_focus_command(const char *arg, int from_tty)
static struct tui_win_info * tui_partial_win_by_name(gdb::string_view name)
static struct tui_translate tui_border_kind_translate_lrcorner[]
static void winheight_completer(struct cmd_list_element *ignore, completion_tracker &tracker, const char *text, const char *word)
void set_screen_width_and_height(int width, int height)
void gdb_printf(struct ui_file *stream, const char *format,...)
void printf_unfiltered(const char *format,...)