Is it possible to change buffer in TextView (SourceView) when providing Word-Completion?



All,

  I have been wrestling with this issue for a month (not continually, but as
time and curiosity permit). I have posted before with the specifics of the
problem (see thread: "Howto register/unregister words completion provider on
buffer change in textview?")

  I have boiled it down to a simple question:

"Is it possible to change the buffer shown in a TextView (using gtksourceview)
and have word-completion continue to work within that TextView?"


  The reason I ask is that it appears the completion is indelibly bound to the
original buffer in the textview when word-completion is first activated. There
does not seem to be a way to:

  gtk_source_completion_remove_provider  /* removing and unreffing all */

and then after gtk_text_view_set_buffer (view, newbuf);

  gtk_source_completion_add_provider

and have word-completion function.


  Similarly, there seems to be no way to retain the same completion provider
(so remove/add is unnecessary) and simply:

  gtk_source_completion_words_unregister (prov_words, oldbuf);

and then to update the words in the provider:

  gtk_source_completion_words_register (prov_words, newbuf);


  In all cases, the exact same behavior is observed. When the buffer is
changed and all GtkSourceCompletionWords providers removed and a new provider
created, words registered and added with the new buffer in the textview, word
completion is non functional, no popup, no nothing.

  However if I go through the same process again and change the buffer shown
in the textview from newbuf to original, remove all providers, creating a new
provider, registering words (in the exact same order), then Walah! completion
is magically working again.

  I've looked at the source code for GtkSourceView and unfortunately, most of
it is bewildering, but it does appear there is a binding between the original
buffer and the GtkSourceCompletion for the textview and the original buffer in
the textview when completion is first activated.

  Is this right?? And, if it is, doesn't that effectively prevent changing
buffers in a sourceview and having completion continue to function? And if
that is the case, is this a bug or a feature?

  The code is currently written using GtkSourceView 2.11.2, but 3.23.2 and
4.0.2 seem identical in this regard.

  If nobody knows, is there a GtkSourceView specific list I can follow up on?
It just doesn't seem right that I would need to destroy the entire textview
window just to keep completion working with a new buffer.

  Any help greatly appreciated.

-- 
David C. Rankin, J.D.,P.E.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]