From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by sourceware.org (Postfix) with ESMTP id 91AA8386F816 for ; Sun, 24 May 2020 16:44:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 91AA8386F816 Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-245-zEHlrUHJPB2SEJeMhyt04Q-1; Sun, 24 May 2020 12:44:41 -0400 X-MC-Unique: zEHlrUHJPB2SEJeMhyt04Q-1 Received: by mail-wr1-f69.google.com with SMTP id w4so1389334wrl.13 for ; Sun, 24 May 2020 09:44:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=KuSNuOXdemqBRHAF0jgCRVlzY+1zGXVQj3qZTBplYzU=; b=aIEZBEtxBuJC8oxLV+JfCT0igOy7OvqRIRnTv3HBq8CHzrRXKFqXk46wPP9sX1jtvo 9464UoZtRs7PWSIhUHDsVUIgxLZ65OU7xJdO0v5fgvtMY10oneQTRVXid+ym3ynt6pai S2G7FFWWa13d/1GhAajcB0o1irg2S5D+W33XOY/BKycVGFWwxwOhJIqn8fMclhyEBiBj 1wkbJZy/ScZY7Rxp8ecGbkjIwTV3TcMp/yIIRIvQ3RqkILRIIA0okN0nTIBS8LRKixMA lsvpufrKZx9jpBrpJf7wKFVuR8GAIFxVbq+0WGySW6P0YCfVhIwLcXw0T8w147Xe34uc jBZw== X-Gm-Message-State: AOAM530a5gU8lNZauQnoXcbYdyZWq8N5QiR/9w0uYQx+ghcRaIW3VrKV 38oDgkuPhNqSLLv2M7gamd38+5FRF4BDtlelPJ7oDm3P2bInZ1eOqkBMGQCSiQZoScAmUrT+yMs 3INlN2jTmuNjMQ6skCnUIeg== X-Received: by 2002:a5d:60c3:: with SMTP id x3mr8995012wrt.48.1590338680234; Sun, 24 May 2020 09:44:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwHp80XpLYjLtw7hcOA7ifwyYFtuOrXHQrx389k7AAO64y/mDn20JJYTdvWWtg9HVK1V5/a5g== X-Received: by 2002:a5d:60c3:: with SMTP id x3mr8995005wrt.48.1590338680039; Sun, 24 May 2020 09:44:40 -0700 (PDT) Received: from ?IPv6:2001:8a0:f909:7b00:2327:23ca:3e56:ef5f? ([2001:8a0:f909:7b00:2327:23ca:3e56:ef5f]) by smtp.gmail.com with ESMTPSA id t7sm9420721wrq.41.2020.05.24.09.44.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 24 May 2020 09:44:39 -0700 (PDT) Subject: Re: [PATCH] Add completion styling To: Eli Zaretskii References: <20200409024112.18065-1-tom@tromey.com> <83369dp3gy.fsf@gnu.org> <87eesc1x2d.fsf@tromey.com> <4b370f83-3954-bbc4-50b5-1528e8b4fca5@redhat.com> <83a71xxul5.fsf@gnu.org> <0bee2d7c-4fe2-f6ff-088a-2d0c2730fbc9@redhat.com> <83wo51wb31.fsf@gnu.org> Cc: tom@tromey.com, gdb-patches@sourceware.org From: Pedro Alves Message-ID: Date: Sun, 24 May 2020 17:44:38 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <83wo51wb31.fsf@gnu.org> Content-Language: en-US X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2020 16:44:44 -0000 On 5/24/20 5:29 PM, Eli Zaretskii wrote: >> Cc: tom@tromey.com, gdb-patches@sourceware.org >> From: Pedro Alves >> Date: Sun, 24 May 2020 16:30:07 +0100 >> >>>> while it should highlight here: >>>> >>>> selftests::string_view::cons_1::main() >>>> selftests::string_view::cons_2::main() >>>> selftests::string_view::cons_3::main() >>>> ^ >>> >>> Really? not here: >>> >>> selftests::string_view::cons_1::main() >>> ^ >> >> I don't understand. Under the "1"? Why? > > because that's the first difference between the candidates. > >> My understanding is that "set style completion-difference" highlights the >> first character that follows the string that the user typed, right? > > No, it highlights the first character from the left that distinguishes > between candidates. That is the character the user _has_ to type to > narrow his/her choice, potentially resolving it to a single candidate. Well, that's the same thing, but expressed better. I just didn't realize that you were looking at the whole prefix. It's obvious to me now what you mean. > >>> But I actually don't understand how did we get these candidates by >>> typing "main". Don't we complete by looking for strings that begin >>> with what the user typed? I'm probably missing something here. >> >> You're missing that "b main" sets a breakpoint on every "main" >> function in every namespace. > > OK, but then I still stand by my expectations. Although implementing > that may not be easy given that the candidates don't start with what > the user typed. I know from experience that getting the lower common denominator to not be a simple common prefix of the completion matches wasn't easy. But it works now, and GDB has all the info, since it is GDB that informs GDB about the common prefix, so it should be possible. Thanks, Pedro Alves