]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Don't erase TUI source window when switching focus
authorTom Tromey <tromey@adacore.com>
Mon, 19 Oct 2020 13:45:05 +0000 (07:45 -0600)
committerTom Tromey <tromey@adacore.com>
Mon, 19 Oct 2020 19:45:24 +0000 (13:45 -0600)
PR tui/26719 points out that switching the focus can erase the TUI
source window.  This is a regression introduced by the patch to switch
the source window to using a pad.

This patch fixes the bug by arranging to call prefresh whenever the
window is refreshed.

2020-10-19  Tom Tromey  <tromey@adacore.com>

PR tui/26719
* tui/tui-winsource.h (struct tui_source_window_base)
<refresh_window>: Rename from refresh_pad.
* tui/tui-winsource.c (tui_source_window_base::refresh_window):
Rename from refresh_pad.
(tui_source_window_base::show_source_content)
(tui_source_window_base::do_scroll_horizontal): Update.

gdb/testsuite/ChangeLog
2020-10-19  Tom Tromey  <tromey@adacore.com>

PR tui/26719
* gdb.tui/list.exp: Check source window contents after focus
change.

gdb/ChangeLog
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.tui/list.exp
gdb/tui/tui-winsource.c
gdb/tui/tui-winsource.h

index 428ced4d35cc57e8d9388976bbe6e9a7d752462e..4dc1e42c3b6ddcf8d5d960e5f035b9668dcabe79 100644 (file)
@@ -1,3 +1,13 @@
+2020-10-19  Tom Tromey  <tromey@adacore.com>
+
+       PR tui/26719
+       * tui/tui-winsource.h (struct tui_source_window_base)
+       <refresh_window>: Rename from refresh_pad.
+       * tui/tui-winsource.c (tui_source_window_base::refresh_window):
+       Rename from refresh_pad.
+       (tui_source_window_base::show_source_content)
+       (tui_source_window_base::do_scroll_horizontal): Update.
+
 2020-10-19  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>
 
        * thread.c (_initialize_thread): Fine-tune the help text of
index d5137978a224a26c9a2b7392dc0053d892fe3adb..0a22f67864de75ec74b013059c55c08a41d28305 100644 (file)
@@ -1,3 +1,9 @@
+2020-10-19  Tom Tromey  <tromey@adacore.com>
+
+       PR tui/26719
+       * gdb.tui/list.exp: Check source window contents after focus
+       change.
+
 2020-10-17  Tom de Vries  <tdevries@suse.de>
 
        PR symtab/26317
index a31c912428ae9309b13bd0acaf58e588e839b16a..8c7585b295a309588ab131e9706bc7c08a36bb87 100644 (file)
@@ -40,3 +40,5 @@ Term::check_contents "list -q main" "21 *return 0"
 # to ensure that GDB has a valid idea of what is currently focused.
 Term::command "focus next"
 Term::check_contents "focus next" "Focus set to cmd window"
+# PR tui/26719 - switching focus would clear the source window.
+Term::check_contents "source is still visible" "21 *return 0"
index 30b8f69027aed0a94e3f5d3bc44c7f8e5a298638..957d9310f7a8717ffa0bc3ddf00ae4a28a6d9247 100644 (file)
@@ -250,8 +250,10 @@ tui_source_window_base::show_source_line (int lineno)
 /* See tui-winsource.h.  */
 
 void
-tui_source_window_base::refresh_pad ()
+tui_source_window_base::refresh_window ()
 {
+  tui_win_info::refresh_window ();
+
   int pad_width = std::max (m_max_length, width);
   int left_margin = 1 + TUI_EXECINFO_SIZE + extra_margin ();
   int view_width = width - left_margin - 1;
@@ -278,8 +280,6 @@ tui_source_window_base::show_source_content ()
   for (int lineno = 0; lineno < m_content.size (); lineno++)
     show_source_line (lineno);
 
-  refresh_pad ();
-
   refresh_window ();
 }
 
@@ -377,7 +377,7 @@ tui_source_window_base::do_scroll_horizontal (int num_to_scroll)
       if (offset < 0)
        offset = 0;
       m_horizontal_offset = offset;
-      refresh_pad ();
+      refresh_window ();
     }
 }
 
index 5fc6a6d812662ece0f09491d2dae560394df6997..6dcf0efe4b9524dec1e096c1302a0d5583da93d0 100644 (file)
@@ -171,6 +171,8 @@ public:
   /* Erase the source content.  */
   virtual void erase_source_content () = 0;
 
+  void refresh_window () override;
+
   /* Return the start address and gdbarch.  */
   virtual void display_start_addr (struct gdbarch **gdbarch_p,
                                   CORE_ADDR *addr_p) = 0;
@@ -179,9 +181,6 @@ private:
 
   void show_source_content ();
 
-  /* Re-display the pad in the window.  */
-  void refresh_pad ();
-
   /* Called when the user "set style enabled" setting is changed.  */
   void style_changed ();