Problems with Autocompletion

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Problems with Autocompletion

kyanh-2
Hi!

I am currentlly maintaining winefish latex editor ( http://winefish.sf.net/ )

= 0 =

I wrote successfully the completion support for program. But currently, only
the latex commands which are started by a back slash (\) are recognized. For
example,

\testa
\testb

(latex commands often start with \)

See [1] for details.

= 1 =

Now i want to support completion for words. The problem is that it is hard to
recognized words, cause a word may be started by a boundary characters
(newline, tab, back slash,....).

How can I do? I thought of some solutions, but i donnot know the best
quality :)


Thanks for replies.

ky anh -- GTK newbie

PS:

[1]

{/* get text at doc's iterator */
 GtkTextMark * imark;
 GtkTextIter itstart, iter, maxsearch;
 imark = gtk_text_buffer_get_insert( doc->buffer );
 gtk_text_buffer_get_iter_at_mark( doc->buffer, &iter, imark );
 itstart = iter;
 maxsearch = iter;
 gtk_text_iter_backward_chars( &maxsearch, 50 );

 /* find backward the \\ ; the result may contains newline character :( */  
 if ( gtk_text_iter_backward_find_char( &itstart, ( GtkTextCharPredicate )
   find_char, GINT_TO_POINTER( "\\" ), &maxsearch ) ) {
  maxsearch = iter; /* re-use maxsearch */
  buf = gtk_text_buffer_get_text( doc->buffer, &itstart, &maxsearch, FALSE );
 }
 }

/* buf will be used for completion -- using GCompletion structure */
_______________________________________________
gtk-list mailing list
[hidden email]
http://mail.gnome.org/mailman/listinfo/gtk-list