[PATCH] Add completion styling

Pedro Alves palves@redhat.com
Sun May 24 16:44:38 GMT 2020


On 5/24/20 5:29 PM, Eli Zaretskii wrote:
>> Cc: tom@tromey.com, gdb-patches@sourceware.org
>> From: Pedro Alves <palves@redhat.com>
>> 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



More information about the Gdb-patches mailing list