[review] Re-highlight windows when needed during TUI startup

Message ID gerrit.1573404038000.I1a4563fb431833dd3211a224c9e2df3b936fe9ce@gnutoolchain-gerrit.osci.io
State New, archived
Headers

Commit Message

Simon Marchi (Code Review) Nov. 10, 2019, 4:40 p.m. UTC
  Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/607
......................................................................

Re-highlight windows when needed during TUI startup

I noticed that "tui enable" did not correctly show the source window
as having the focus.  Debugging showed that the problem was that
tui_update_variables was called after the windows were drawn, and its
result was being ignored.  This changed the code to re-highlight the
windows if the value changed.

gdb/ChangeLog
2019-11-10  Tom Tromey  <tom@tromey.com>

	* tui/tui.c (tui_enable): Call tui_update_variables earlier.

Change-Id: I1a4563fb431833dd3211a224c9e2df3b936fe9ce
---
M gdb/ChangeLog
M gdb/tui/tui.c
2 files changed, 7 insertions(+), 2 deletions(-)
  

Patch

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 7ea57bc..b5e0284 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,9 @@ 
 2019-11-10  Tom Tromey  <tom@tromey.com>
 
+	* tui/tui.c (tui_enable): Call tui_update_variables earlier.
+
+2019-11-10  Tom Tromey  <tom@tromey.com>
+
 	* NEWS: Document new settings.
 	* tui/tui-wingeneral.c (box_win): Apply appropriate border style.
 	* tui/tui-win.c (_initialize_tui_win): Add border style
diff --git a/gdb/tui/tui.c b/gdb/tui/tui.c
index 1568351..1724b2b 100644
--- a/gdb/tui/tui.c
+++ b/gdb/tui/tui.c
@@ -494,8 +494,9 @@ 
   tui_install_hooks ();
   rl_startup_hook = tui_rl_startup_hook;
 
-  tui_update_variables ();
-  
+  if (tui_update_variables ())
+    tui_rehighlight_all ();
+
   tui_setup_io (1);
 
   tui_active = 1;