Cursor position in a Gtk::TextBuffer

W

WoodHacker

I have not had great luck asking Gtk questions on this site, but I
don't know where else to turn....

I am writing my own editor and want to have syntax coloring. I scan
the file and sets tags to get what I want and it works fine for an
existing file. However, I need also to be able to add text to the
file and to create new files and have the coloring work as I type.
My question is, how do I get the number of the line I'm on? This will
allow me to get the iterator of that line and allow me to color the
line as I type. I can get the line from the window coordinates, but
how do I get the window coordinates? I can get them from the cursor
position, but how do I get the cursor position? How do I tell where I
am in the text buffer? The signal "changed" does not seem to return
an event structure that would allow me to get event.x and event.y.

Obviously, I'm not the first person who's had this problem, and I'm
sure I'm missing something, but as of right now I'm lost.

Bill
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top