Inline constructors and initializers
[deliverable/binutils-gdb.git] / gdb / tui / tui-hooks.c
index efa02e2f08a0a2ef7971ab328271fbb1fb9692c7..4a1d79e0ad0b8aaf19b416665595a6565d320fb7 100644 (file)
@@ -1,6 +1,6 @@
 /* GDB hooks for TUI.
 
-   Copyright (C) 2001-2018 Free Software Foundation, Inc.
+   Copyright (C) 2001-2019 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -33,6 +33,7 @@
 #include "ui-out.h"
 #include "top.h"
 #include "observable.h"
+#include "source.h"
 #include <unistd.h>
 #include <fcntl.h>
 
@@ -203,9 +204,21 @@ tui_normal_stop (struct bpstats *bs, int print_frame)
   tui_refresh_frame_and_register_information (/*registers_too_p=*/1);
 }
 
+/* Observer for source_cache_cleared.  */
+
+static void
+tui_redisplay_source ()
+{
+  if (tui_is_window_visible (SRC_WIN))
+    {
+      /* Force redisplay.  */
+      tui_refill_source_window (tui_win_list[SRC_WIN]);
+    }
+}
+
 /* Token associated with observers registered while TUI hooks are
    installed.  */
-static const gdb::observers::token tui_observers_token;
+static const gdb::observers::token tui_observers_token {};
 
 /* Attach or detach a single observer, according to ATTACH.  */
 
@@ -238,6 +251,8 @@ tui_attach_detach_observers (bool attach)
                    tui_normal_stop, attach);
   attach_or_detach (gdb::observers::register_changed,
                    tui_register_changed, attach);
+  attach_or_detach (gdb::observers::source_styling_changed,
+                   tui_redisplay_source, attach);
 }
 
 /* Install the TUI specific hooks.  */
This page took 0.024077 seconds and 4 git commands to generate.