aboutsummaryrefslogtreecommitdiff
path: root/gdb/tui/tui-win.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2019-06-16 14:52:08 -0600
committerTom Tromey <tom@tromey.com>2019-06-25 07:48:34 -0600
commit1825f487ae903438eb2a9b6f461337d8ec1b06c0 (patch)
treead8848b326dff919ab0ae05d62a9e9e9a62d4515 /gdb/tui/tui-win.c
parentad54d15bdb71b05010ece1ef32ab22ab46794166 (diff)
downloadgdb-1825f487ae903438eb2a9b6f461337d8ec1b06c0.zip
gdb-1825f487ae903438eb2a9b6f461337d8ec1b06c0.tar.gz
gdb-1825f487ae903438eb2a9b6f461337d8ec1b06c0.tar.bz2
Introduce the refresh_all method
This introduces the tui_win_info::refresh_all method and implements it as needed in subclasses. The name and comment are a bit of a guess on my part. The main benefit of this patch is removing another switch on the type of the window. gdb/ChangeLog 2019-06-25 Tom Tromey <tom@tromey.com> * tui/tui.c (tui_rl_other_window): Call the refresh_all method. * tui/tui-windata.c (tui_data_window::refresh_all): Rename from tui_refresh_data_win. * tui/tui-win.c (tui_source_window_base::refresh_all): New method. (tui_refresh_all_win): Call the refresh_all method. (tui_set_focus): Likewise. * tui/tui-data.h (struct tui_win_info) <refresh_all>: New method. (struct tui_source_window_base, struct tui_data_window) <refresh>: Likewise.
Diffstat (limited to 'gdb/tui/tui-win.c')
-rw-r--r--gdb/tui/tui-win.c34
1 files changed, 14 insertions, 20 deletions
diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c
index 9c4f9ad..383487e 100644
--- a/gdb/tui/tui-win.c
+++ b/gdb/tui/tui-win.c
@@ -508,6 +508,17 @@ tui_win_info::right_scroll (int num_to_scroll)
}
+/* See tui-data.h. */
+
+void
+tui_source_window_base::refresh_all ()
+{
+ tui_show_source_content (this);
+ tui_check_and_display_highlight_if_needed (this);
+ tui_erase_exec_info_content (this);
+ tui_update_exec_info (this);
+}
+
void
tui_refresh_all_win (void)
{
@@ -517,25 +528,8 @@ tui_refresh_all_win (void)
tui_refresh_all (tui_win_list);
for (type = SRC_WIN; type < MAX_MAJOR_WINDOWS; type++)
{
- if (tui_win_list[type]
- && tui_win_list[type]->generic.is_visible)
- {
- switch (type)
- {
- case SRC_WIN:
- case DISASSEM_WIN:
- tui_show_source_content (tui_win_list[type]);
- tui_check_and_display_highlight_if_needed (tui_win_list[type]);
- tui_erase_exec_info_content (tui_win_list[type]);
- tui_update_exec_info (tui_win_list[type]);
- break;
- case DATA_WIN:
- tui_refresh_data_win ();
- break;
- default:
- break;
- }
- }
+ if (tui_win_list[type] && tui_win_list[type]->generic.is_visible)
+ tui_win_list[type]->refresh_all ();
}
tui_show_locator_content ();
}
@@ -872,7 +866,7 @@ The window name specified must be valid and visible.\n"));
}
if (TUI_DATA_WIN && TUI_DATA_WIN->generic.is_visible)
- tui_refresh_data_win ();
+ TUI_DATA_WIN->refresh_all ();
xfree (buf_ptr);
printf_filtered (_("Focus set to %s window.\n"),
tui_win_name (&tui_win_with_focus ()->generic));