From 6f11e6824e15bd40fe1e7b245a22865c6ef8c7bd Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Fri, 8 Mar 2019 13:41:55 -0700 Subject: Make TUI react to "set style enabled" When the user toggles "set style enabled", the TUI should react by redrawing the source window, if necessary. This patch implements this behavior. No test because the TUI is generally not tested. This version of the patch incorporates Pedro's patch to provide a clean way to force the TUI to update the source window's contents. gdb/ChangeLog 2019-03-14 Pedro Alves Tom Tromey * tui/tui-winsource.h (tui_refill_source_window): Declare. * tui/tui-winsource.c (tui_refill_source_window): New function, from... (tui_horizontal_source_scroll): ... here. Move some logic. * cli/cli-style.c (set_style_enabled): Notify new observable. * tui/tui-hooks.c (tui_redisplay_source): New function. (tui_attach_detach_observers): Attach or detach tui_redisplay_source. * observable.h (source_styling_changed): New observable. * observable.c: Define source_styling_changed observable. --- gdb/cli/cli-style.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'gdb/cli/cli-style.c') diff --git a/gdb/cli/cli-style.c b/gdb/cli/cli-style.c index ec385da..fc91504 100644 --- a/gdb/cli/cli-style.c +++ b/gdb/cli/cli-style.c @@ -21,6 +21,7 @@ #include "cli/cli-cmds.h" #include "cli/cli-style.h" #include "source-cache.h" +#include "observable.h" /* True if styling is enabled. */ @@ -216,6 +217,7 @@ static void set_style_enabled (const char *args, int from_tty, struct cmd_list_element *c) { g_source_cache.clear (); + gdb::observers::source_styling_changed.notify (); } static void -- cgit v1.1