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

Message ID 831tn799zv.fsf@gnu.org
State New, archived
Headers

Commit Message

Eli Zaretskii Jan. 6, 2015, 3:58 p.m. UTC
  > Date: Mon, 05 Jan 2015 19:29:20 +0000
> From: Pedro Alves <palves@redhat.com>
> 
> >  @item tabset @var{nchars}
> >  @kindex tabset
> > -Set the width of tab stops to be @var{nchars} characters.
> > +Set the width of tab stops to be @var{nchars} characters.  This
> > +setting affects the display of TAB characters in the source and
> > +assembly windows.
> >  @end table
> 
> (this is yet another setting that would be nicer if the TUI reflected
> updates immediately.)

Like this?

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

	* tui/tui-win.c (tui_set_tab_width_command): Delete and
	recreate the source and the disassembly windows, to show the
	effect of the changed tab size immediately.
  

Comments

Pedro Alves Jan. 6, 2015, 4:20 p.m. UTC | #1
On 01/06/2015 03:58 PM, Eli Zaretskii wrote:
>> Date: Mon, 05 Jan 2015 19:29:20 +0000
>> From: Pedro Alves <palves@redhat.com>
>>
>>>  @item tabset @var{nchars}
>>>  @kindex tabset
>>> -Set the width of tab stops to be @var{nchars} characters.
>>> +Set the width of tab stops to be @var{nchars} characters.  This
>>> +setting affects the display of TAB characters in the source and
>>> +assembly windows.
>>>  @end table
>>
>> (this is yet another setting that would be nicer if the TUI reflected
>> updates immediately.)
> 
> Like this?

Yep, looks good.  Thanks!

> 
> 2015-01-06  Eli Zaretskii  <eliz@gnu.org>
> 
> 	* tui/tui-win.c (tui_set_tab_width_command): Delete and
> 	recreate the source and the disassembly windows, to show the
> 	effect of the changed tab size immediately.

Pedro Alves
  
Eli Zaretskii Jan. 16, 2015, 3:56 p.m. UTC | #2
> Date: Tue, 06 Jan 2015 16:20:23 +0000
> From: Pedro Alves <palves@redhat.com>
> CC: gdb-patches@sourceware.org
> 
> On 01/06/2015 03:58 PM, Eli Zaretskii wrote:
> >> Date: Mon, 05 Jan 2015 19:29:20 +0000
> >> From: Pedro Alves <palves@redhat.com>
> >>
> >>>  @item tabset @var{nchars}
> >>>  @kindex tabset
> >>> -Set the width of tab stops to be @var{nchars} characters.
> >>> +Set the width of tab stops to be @var{nchars} characters.  This
> >>> +setting affects the display of TAB characters in the source and
> >>> +assembly windows.
> >>>  @end table
> >>
> >> (this is yet another setting that would be nicer if the TUI reflected
> >> updates immediately.)
> > 
> > Like this?
> 
> Yep, looks good.  Thanks!

Thanks, pushed.
  

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
@@ -1020,7 +1026,27 @@  tui_set_tab_width_command (char *arg, in
 
       ts = atoi (arg);
       if (ts > 0)
-	tui_set_default_tab_len (ts);
+	{
+	  tui_set_default_tab_len (ts);
+	  /* We don't really change the height of any windows, but
+	     calling these 2 functions causes a complete regeneration
+	     and redisplay of the window's contents, which will take
+	     the new tab width into account.  */
+	  if (tui_win_list[SRC_WIN]
+	      && tui_win_list[SRC_WIN]->generic.is_visible)
+	    {
+	      make_invisible_and_set_new_height (TUI_SRC_WIN,
+						 TUI_SRC_WIN->generic.height);
+	      make_visible_with_new_height (TUI_SRC_WIN);
+	    }
+	  if (tui_win_list[DISASSEM_WIN]
+	      && tui_win_list[DISASSEM_WIN]->generic.is_visible)
+	    {
+	      make_invisible_and_set_new_height (TUI_DISASM_WIN,
+						 TUI_DISASM_WIN->generic.height);
+	      make_visible_with_new_height (TUI_DISASM_WIN);
+	    }
+	}
       else
 	warning (_("Tab widths greater than 0 must be specified."));
     }