From: Pedro Alves <palves@redhat.com>
To: Andrew Burgess <andrew.burgess@embecosm.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH] gdb/tui: Add command completion to winheight command.
Date: Fri, 10 Jul 2015 16:24:00 -0000 [thread overview]
Message-ID: <559FF19E.3010208@redhat.com> (raw)
In-Reply-To: <1436534024-23458-1-git-send-email-andrew.burgess@embecosm.com>
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
next prev parent reply other threads:[~2015-07-10 16:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-10 13:13 Andrew Burgess
2015-07-10 16:24 ` Pedro Alves [this message]
2015-07-12 8:51 ` Andrew Burgess
2015-07-12 14:59 ` Pedro Alves
2015-07-12 21:34 ` Andrew Burgess
2015-07-13 9:42 ` Pedro Alves
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=559FF19E.3010208@redhat.com \
--to=palves@redhat.com \
--cc=andrew.burgess@embecosm.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox