Re: keeping track of specific characters in a GtkTextBuffer



--- tomas tuxteam de wrote:

-----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.

Does anyone know if there's a function like this and
what it's called? If such a function doesn't exist
what should my next course of action be?

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...

My point exactly!

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


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





                
___________________________________________________________ 
The all-new Yahoo! Mail goes wherever you go - free your email address from your Internet provider. 
http://uk.docs.yahoo.com/nowyoucan.html



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