Make TUI borders respect "set style enabled"
authorTom Tromey <tom@tromey.com>
Sat, 4 Jan 2020 21:35:02 +0000 (14:35 -0700)
committerTom Tromey <tom@tromey.com>
Sat, 11 Jan 2020 19:24:03 +0000 (12:24 -0700)
When adding support for styling the TUI borders, I neglected to have
this code check cli_styling.  As a result, "set style enabled off"
does not affect the borders.

This patch fixes this oversight.  While doing this, I found that
running gdb without an executable, enabling the TUI, and then trying
"set style enabled off" would fail with the mysterious "No registers".
The fix for this is to use deprecated_safe_get_selected_frame in
tui_source_window_base::refill.

gdb/ChangeLog
2020-01-11  Tom Tromey  <tom@tromey.com>

* tui/tui-wingeneral.c (box_win): Check cli_styling.
* tui/tui-winsource.c (tui_source_window_base::refill): Use
deprecated_safe_get_selected_frame.

Change-Id: I36acda25dd9014d994d366b4a0e8faee9d95d0f8

gdb/ChangeLog
gdb/tui/tui-wingeneral.c
gdb/tui/tui-winsource.c

index ed2856c2466203cc85139e1564ae0d8663b29f12..735c46bf70534707f0274db8f1f5a42e6d2cd36f 100644 (file)
@@ -1,3 +1,9 @@
+2020-01-11  Tom Tromey  <tom@tromey.com>
+
+       * tui/tui-wingeneral.c (box_win): Check cli_styling.
+       * tui/tui-winsource.c (tui_source_window_base::refill): Use
+       deprecated_safe_get_selected_frame.
+
 2020-01-10  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>
 
        * inferior.c (print_inferior): Switch inferior before printing it.
index dae4255ada2009e0cd3fdd68baffc20881d3782a..0a9fc5238d6121ca59a772bd8f5cb656a4774310 100644 (file)
@@ -55,9 +55,10 @@ box_win (struct tui_win_info *win_info,
 
   /* tui_apply_style resets the style entirely, so be sure to call it
      before applying ATTRS.  */
-  tui_apply_style (win, (highlight_flag
-                        ? tui_active_border_style.style ()
-                        : tui_border_style.style ()));
+  if (cli_styling)
+    tui_apply_style (win, (highlight_flag
+                          ? tui_active_border_style.style ()
+                          : tui_border_style.style ()));
   wattron (win, attrs);
 #ifdef HAVE_WBORDER
   wborder (win, tui_border_vline, tui_border_vline,
index 69070115ec69ca99ef3d653d368c3fcdeb454e8d..fbee2e3e1813bc8acbcc393f9a704bb1d5230406 100644 (file)
@@ -352,7 +352,11 @@ tui_source_window_base::refill ()
     {
       sal = get_current_source_symtab_and_line ();
       if (sal.symtab == NULL)
-       sal = find_pc_line (get_frame_pc (get_selected_frame (NULL)), 0);
+       {
+         struct frame_info *fi = deprecated_safe_get_selected_frame ();
+         if (fi != nullptr)
+           sal = find_pc_line (get_frame_pc (fi), 0);
+       }
     }
 
   if (sal.pspace == nullptr)
This page took 0.026964 seconds and 4 git commands to generate.