Re: char distance between two GtkTextMarks?



Joshua N Pritikin <vishnu pobox com> writes:
What is the recommended way to calculate the number of characters between
two GtkTextMarks?

i can loop with gtk_text_iter_forward_chars, but isn't this slow?

Is there a GtkTextIter API which i have overlooked?

buffer_get_iter_at_mark (buffer, &iter1, mark1);
buffer_get_iter_at_mark (buffer, &iter2, mark2);
pos1 = iter_get_offset (&iter1);
pos2 = iter_get_offset (&iter2);
chars_between = ABS (pos2 - pos1);

Havoc




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