This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] gdb/tui: Add command completion to winheight command.


On 07/10/2015 02:13 PM, Andrew Burgess wrote:
> Share the window name completion code from the focus command with the
> winheight command, providing window name completion for the winheight
> command.

Thanks.

har *null_args, int from_tty, struct cmd_list_element *c)
>      tui_rehighlight_all ();
>  }
>  
> -/* Complete possible window names to focus on.  TEXT is the complete text
> -   entered so far, WORD is the word currently being completed.  */
> +/* Generic window name completion function.  Complete window name pointed
> +   too by TEXT and WORD.  If INCLUDE_NEXT_PREV_P is true then the special

"pointed to" ?

> +   window names 'next' and 'prev' are also included in the list of possible
> +   completions (if appropriate).  */
>  
>  static VEC (char_ptr) *
> -focus_completer (struct cmd_list_element *ignore,
> -		  const char *text, const char *word)
> +window_name_completer (int include_next_prev_p,
> +		       const char *text, const char *word)
>  {
>    VEC (const_char_ptr) *completion_name_vec = NULL;
>    VEC (char_ptr) *matches_vec;
> -  int win_type;
>  
> -  for (win_type = SRC_WIN; win_type < MAX_MAJOR_WINDOWS; win_type++)
> +  if (tui_active)
>      {

...

> -  /* If no windows are considered visible then the TUI has not yet been
> -     initialized.  But still "focus src" and "focus cmd" will work because
> -     invoking the focus command will entail initializing the TUI which sets the
> -     default layout to SRC_COMMAND.  */
> -  if (VEC_length (const_char_ptr, completion_name_vec) == 0)
> +	  completion_name = tui_win_name (&tui_win_list [win_type]->generic);
> +	  gdb_assert (completion_name != NULL);
> +	  VEC_safe_push (const_char_ptr, completion_name_vec, completion_name);
> +	}
> +    }
> +  else
>      {
> +      /* If the tui is not yet active then we should still offer up the two
> +	 initial windows 'src' and 'cmd'.  All tui commands will
> +	 auto-activate the tui, which means these windows are valid for
> +	 use.  */

This changed the predicate used to get here, and it doesn't look right
to me.  It used to be "not initialized yet" (no window marked visible,
no matter whether the tui is active), now it's "tui active".  The former
meant that because tui had not been initialized, then the current layout
once the tui is initialized the default layout contains the src and cmd
windows.  But with the new predicate that is not always correct.
We should be able to enable the tui, do "layout asm", disable the tui,
and then do "focus <tab>".  This should offer the asm window, not
the src window.  That works today, but I think will not work after
your patch?

Thanks,
Pedro Alves


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]