Can you specify the No. of chars before SourceView Completion window is displayed?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Can you specify the No. of chars before SourceView Completion window is displayed?

David C. Rankin
All,

  I have implemented word completion with GtkSourceView, but I cannot find a
simple way to prevent the provider and proposals from popping up until 3 (or
more) characters are typed? Is there an easier way to adjust this rather than
counting chars with an iter from every begins_word and blocking the display of
the completion window until the desired number of characters have been typed?

--
David C. Rankin, J.D.,P.E.
_______________________________________________
gtk-app-devel-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Reply | Threaded
Open this post in threaded view
|

Re: Can you specify the No. of chars before SourceView Completion window is displayed?

John Coppens
On Sat, 28 Jul 2018 03:35:02 -0500
"David C. Rankin" <[hidden email]> wrote:

> All,
>
>   I have implemented word completion with GtkSourceView, but I cannot
> find a simple way to prevent the provider and proposals from popping
> up until 3 (or more) characters are typed? Is there an easier way to
> adjust this rather than counting chars with an iter from every
> begins_word and blocking the display of the completion window until
> the desired number of characters have been typed?
>

David, is 'set_minimum_key_length' what you are looking for?

John
_______________________________________________
gtk-app-devel-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Reply | Threaded
Open this post in threaded view
|

Re: Can you specify the No. of chars before SourceView Completion window is displayed?

David C. Rankin
On 07/28/2018 08:12 AM, John Coppens wrote:

> On Sat, 28 Jul 2018 03:35:02 -0500
> "David C. Rankin" <[hidden email]> wrote:
>
>> All,
>>
>>   I have implemented word completion with GtkSourceView, but I cannot
>> find a simple way to prevent the provider and proposals from popping
>> up until 3 (or more) characters are typed? Is there an easier way to
>> adjust this rather than counting chars with an iter from every
>> begins_word and blocking the display of the completion window until
>> the desired number of characters have been typed?
>>
>
> David, is 'set_minimum_key_length' what you are looking for?
>
> John

John,

  That sounds *exactly* like what I am looking for, but I can't find it.
Currently the completion is triggered after 2-characters are type. That is way
way too over-inclusive and results in the GList of proposals being way larger
than need be. I've been through every property and grepped the source with

 $ grep -r 'set_minimum_key_length' gtksourceview/*

and I can't find any reference to it that would provide an interface to it. Is
this new in gtksourceview4? I have grepped the source for versions 2.11 and
3.23 and nothing turns up.

  Also, (as a bonus question :) how do I hide the priority column in the
completion window and nuke the titlebar and statusbar with the "Details/All"
links?

see: screen shot of completion window: http://paste.opensuse.org/94232695
(link good for 6 days)

  For example, I don't want to display the 1, 2, 3, 4, 5, etc.., priority
column, I just want the words displayed in a small tight window. I don't want
to have the titlebar or the footer with the links to the extra "info" for this
provider (there never will be any, they are just words from the document).

  What I'm trying to achieve is a normal completion window, e.g.

    http://paste.opensuse.org/48387224

  Is there any way to achieve something like that other than capturing the
"show" signal (which would already have displayed the window) and attempting
to hide the titlebar and statusbar of the completion popup? The
"CompletionInfo" window has a "before-show" signal, but there is nothing
similar for the actual completion window?

--
David C. Rankin, J.D.,P.E.
_______________________________________________
gtk-app-devel-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Reply | Threaded
Open this post in threaded view
|

Re: Can you specify the No. of chars before SourceView Completion window is displayed?

David C. Rankin
In reply to this post by John Coppens
On 07/28/2018 08:12 AM, John Coppens wrote:
> David, is 'set_minimum_key_length' what you are looking for?

Oh, no, no, no, not entry-completion, *word-completion* in a text editor
window. (which explains why it was no where to be found in the gtkSourceView
code :)

--
David C. Rankin, J.D.,P.E.
_______________________________________________
gtk-app-devel-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Reply | Threaded
Open this post in threaded view
|

Re: Can you specify the No. of chars before SourceView Completion window is displayed?

David C. Rankin
In reply to this post by David C. Rankin
On 07/28/2018 03:35 AM, David C. Rankin wrote:
> All,
>
>   I have implemented word completion with GtkSourceView, but I cannot find a
> simple way to prevent the provider and proposals from popping up until 3 (or
> more) characters are typed? Is there an easier way to adjust this rather than
> counting chars with an iter from every begins_word and blocking the display of
> the completion window until the desired number of characters have been typed?
>

Found it.

  In the SourceView version I'm using in the (*Undocumented* in 2.11)
completion-providers/words subdirectory of the source,
gtksourcecompletionwordsbuffer.h exposes:

void gtk_source_completion_words_buffer_set_minimum_word_size (
                            GtkSourceCompletionWordsBuffer *buffer,
                            guint size);


that can be used to set the "minimum-word-size" property. You can also set the
property directly with g_object_set called on the GtkSourceCompletionWords
provider. The default value is 2. Setting to 3 does just what I wanted.

--
David C. Rankin, J.D.,P.E.
_______________________________________________
gtk-app-devel-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list