Re: keeping track of specific characters in a GtkTextBuffer



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Wed, Feb 21, 2007 at 04:44:27PM +0000, Adam Tertial wrote:
Hi,

I need to be able to keep track of the location of
specific characters in a GtkTextBuffer, and I was
wondering what the most efficient way of doing that
was. Is it possible to have pointers to characters in
the buffer? I had thought about inserting a
GtkTextMarker whenever the user types the character
I'm interested in, but the documentation says: "If the
text surrounding the mark is deleted, the mark remains
in the position the text once occupied", and I would
want the marks to be deleted along with the text. If
that's the right approach, I suppose when the user
deletes any text I could check all the marks to see if
they were in that text and then delete them myself,
but that seems a bit inefficient to me.

Reading the doc, there seems to be a missing function which might be
called gtk_text_buffer_marks_in_range() which would give you all marks
in a range.

The way things are there seems no other way than checking _all_ marks on
each delete event, which would be O(N) on the number of marks. If you
have many -- well...

Regards
- -- tomÃs
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFF3S9PBcgs9XrR2kYRAmMgAJwJWjEhwlzDnZ8jvKJBsA1nr2bE3ACfQSRe
j8RZy9wtb2EEE3Hy9wrYInA=
=BGXe
-----END PGP SIGNATURE-----




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