Sure, here are some methods to look at:
- getCaretLineNumber(): Line number the caret is on
- getLineOfOffset(int offs): Pass in an offset (such as from a DocumentEvent), get back the line it's in
- getLineStartOffset(int offs): Get the starting offset of the line containing a given offset
- getLineEndOffset(int offs): Get the ending offset of the line containing a given offset
If you want to intercept user edits, and do things such as forbid them from editing text on certain lines (or redirect their insertions to the last line, for example), you will want to use the
DocumentFilter class. Create a subclass that does what you want, and install it on the RSTA instance's Document (cast to RSyntaxDocument to see the setDocumentFilter() method, since it's defined on AbstractDocument but not in the Document interface).