Cursor position in a Gtk::TextBuffer

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs