From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 89856 invoked by alias); 10 Jul 2015 16:24:03 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 89829 invoked by uid 89); 10 Jul 2015 16:24:02 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=no version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 10 Jul 2015 16:24:01 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id BA36A1BE375; Fri, 10 Jul 2015 16:24:00 +0000 (UTC) Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t6AGNwKY029228; Fri, 10 Jul 2015 12:23:59 -0400 Message-ID: <559FF19E.3010208@redhat.com> Date: Fri, 10 Jul 2015 16:24:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Andrew Burgess , gdb-patches@sourceware.org Subject: Re: [PATCH] gdb/tui: Add command completion to winheight command. References: <1436534024-23458-1-git-send-email-andrew.burgess@embecosm.com> In-Reply-To: <1436534024-23458-1-git-send-email-andrew.burgess@embecosm.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2015-07/txt/msg00334.txt.bz2 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 ". 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