searching text



I'm working on porting a simple text note taking application from motif to
gtk. The basics were very easy to get working, but I'm a little stuck on how
to implement search.
In the old implementation, I got the text data, got the curser offset and did
the search with regex.

Looking through the gtk docs, I see there are GtkTextView and GtkSourceView
widgets with corresponding Buffer objects. TextBuffer lists insensitive search as a 
"possible future" feature, while SourceBuffer implements insensitive search,
but still lists regex as "possible future".

I don't need most of what SourceView does, I'm only dealing with plain text.

2 questions.

#1 if I have:
        GtkTextMark *mark;
        GtkTextBuffer *bf;

        data = gtk_text_buffer_get_text (bf, &start, &end, FALSE);
        mark = gtk_text_buffer_get_insert (bf);

is there a simple way to convert mark into an offset into data?
I realize that won't work right with non-ascii characters.

#2 is there yet another set of gtk objects that will give me regex and case
insensitive searches using an official api?
-- 
Chris Bare
chris bareflix com



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