gtk_text_buffer_get_iter_at_offset (), is it O(n) ?



With n the number of Runes in the utf8 buffer?

Should be the same as  gtk_text_iter_set_offset () ?

Well, I am doing some manually coloring in a GtksourceView buffer, and
it is already working, But maybe, if it is O(n) it is not the fastest
solution to call the functions many times, it may be better when I sort
my highlight positions and call something like forward_iter() so the
positioning does not start from the beginning each time.

I was a bit surprised that absolute positioned is only available for
characters, but not for bytes. Assume I have a text area which begins
with "#[" and ends with "]#" which is plain Ascii. So I am really more
interested in byte positions for highlight. I have it working with
character positions, but I have the feeling that it would be a bit
simpler with plain byte locations.

And yes, I know that GtkSourceView does highlighting for us by pattern
matching, that is what current Ned editor does. But the Nim idetools
offer even more advanced highlight information, and I am playing with
using that.



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