diff mbox

[PATCHSET,2/4] Fix various issue in TUI

Message ID 834ms39a40.fsf@gnu.org
State New
Headers show

Commit Message

Eli Zaretskii Jan. 6, 2015, 3:55 p.m. UTC
> Date: Mon, 05 Jan 2015 19:11:21 +0000
> From: Pedro Alves <palves@redhat.com>
> 
> > --- gdb/tui/tui-hooks.c~0	2014-06-11 18:34:41 +0300
> > +++ gdb/tui/tui-hooks.c	2014-12-31 14:41:11 +0200
> > @@ -247,12 +247,23 @@
> >    tui_display_main ();
> >  }
> >
> > +/* Refresh the display when settings important to us change.  */
> > +static void
> > +tui_note_setting_change (const char *param, const char *value)
> > +{
> > +  if (tui_active
> > +      && strncmp (param, "tui ", sizeof ("tui ") - 1) == 0
> > +      && tui_update_variables ())
> > +    tui_rehighlight_all ();
> > +}
> > +
> 
> Please do this from the "set" hook of the relevant commands instead.
> IOW, replace NULL below (and in the other commands):
> 
>   add_setshow_enum_cmd ("active-border-mode", no_class, tui_border_mode_enums,
> 			&tui_active_border_mode, _("\
> ...
> 			NULL,
> 			show_tui_active_border_mode,
> 			&tui_setlist, &tui_showlist);

Like this?

2015-01-06  Eli Zaretskii  <eliz@gnu.org>

	* tui/tui-win.c (tui_set_var_cmd): New function.
	(_initialize_tui_win) <border-kind, border-mode>:
	<active-border-mode>: Use tui_set_var_cmd as the "set" function.

Comments

Pedro Alves Jan. 7, 2015, 1:48 p.m. UTC | #1
On 01/06/2015 03:55 PM, Eli Zaretskii wrote:

> 2015-01-06  Eli Zaretskii  <eliz@gnu.org>
> 
> 	* tui/tui-win.c (tui_set_var_cmd): New function.
> 	(_initialize_tui_win) <border-kind, border-mode>:
> 	<active-border-mode>: Use tui_set_var_cmd as the "set" function.
> 
> --- gdb/tui/tui-win.c~2	2015-01-04 08:07:30 +0200
> +++ gdb/tui/tui-win.c	2015-01-06 08:03:05 +0200
> @@ -346,6 +346,12 @@ tui_get_cmd_list (void)
>    return &tuilist;
>  }
>  
> +void tui_set_var_cmd (char *null_args, int from_tty, struct cmd_list_element *c)

Line break after "void".  Misses an intro comment, maybe something
like:

/* The set_func hook of "set tui ..." settings that affect
   the TUI display.  */

> +{
> +  if (tui_update_variables ())
> +    tui_rehighlight_all ();

The tui_rehighlight_all function is missing in this patch.
Did you indend for this to be tui_refresh_all_win?

Is this OK to call when the tui is not enabled?

Thanks,
Pedro Alves
diff mbox

Patch

--- gdb/tui/tui-win.c~2	2015-01-04 08:07:30 +0200
+++ gdb/tui/tui-win.c	2015-01-06 08:03:05 +0200
@@ -346,6 +346,12 @@  tui_get_cmd_list (void)
   return &tuilist;
 }
 
+void tui_set_var_cmd (char *null_args, int from_tty, struct cmd_list_element *c)
+{
+  if (tui_update_variables ())
+    tui_rehighlight_all ();
+}
+
 /* Function to initialize gdb commands, for tui window
    manipulation.  */
 
@@ -422,7 +428,7 @@  This variable controls the border of TUI
 space           use a white space\n\
 ascii           use ascii characters + - | for the border\n\
 acs             use the Alternate Character Set"),
-			NULL,
+			tui_set_var_cmd,
 			show_tui_border_kind,
 			&tui_setlist, &tui_showlist);
 
@@ -438,7 +444,7 @@  half            use half bright\n\
 half-standout   use half bright and standout mode\n\
 bold            use extra bright or bold\n\
 bold-standout   use extra bright or bold with standout mode"),
-			NULL,
+			tui_set_var_cmd,
 			show_tui_border_mode,
 			&tui_setlist, &tui_showlist);
 
@@ -454,7 +460,7 @@  half            use half bright\n\
 half-standout   use half bright and standout mode\n\
 bold            use extra bright or bold\n\
 bold-standout   use extra bright or bold with standout mode"),
-			NULL,
+			tui_set_var_cmd,
 			show_tui_active_border_mode,
 			&tui_setlist, &tui_showlist);
 }