How to paint something in TextArea?
Submitted by Saturday, 30 October, 2010 - 16:54
on
I'm working on a jEdit plugin for Lisp dialects. I'd like to implement a form "highlighting" feature, just as it's implemented in DrRacket. It can properly highlight a form, when the form is a valid one (screenshot 1). When we have an invalid form (due to some unclosed parenthesis, for example), only the first form paren is highlighted (screenshot 2). I'd rather highlight all the text up to the next form, instead, in some different colour.
Screenshot 1: http://www.tprimke.net/public/images/LispMode_1.png
Screenshot 2: http://www.tprimke.net/public/images/LispMode_2.png
Right now, I don't know how such a feature can be implemented in a jEdit plugin. I've found out the TextAreaExtension, but I'm not sure if it's the proper solution to use in my case. How can I order jEdit (from a plugin) to draw something on the screen? Something, that might consist of many lines and columns, between two known caret positions?
I've found the methods paintValidLine and paintScreenLineRange, but I'm not sure, when they're actually used - so I can't make any use of them. I need some advice on this topic.
Screenshot 1: http://www.tprimke.net/public/images/LispMode_1.png
Screenshot 2: http://www.tprimke.net/public/images/LispMode_2.png
Right now, I don't know how such a feature can be implemented in a jEdit plugin. I've found out the TextAreaExtension, but I'm not sure if it's the proper solution to use in my case. How can I order jEdit (from a plugin) to draw something on the screen? Something, that might consist of many lines and columns, between two known caret positions?
I've found the methods paintValidLine and paintScreenLineRange, but I'm not sure, when they're actually used - so I can't make any use of them. I need some advice on this topic.