Is there a function in RichTextFX to get the actual line number where the curser?
Github: RichTextFX
Is there a function in RichTextFX to get the actual line number where the curser?
Github: RichTextFX
You can get the index of the caret ("cursor") with
int offset = textArea.getCaretPosition();
and then convert to a TwoDimensional.Position with
Position pos = textArea.offsetToPosition(offset);
From there, pos.getMajor() is the paragraph (line) number (and pos.getMinor() is the index of the caret within the line).
You can get the current paragraph index or line number with:
codeArea.getCaretSelectionBind().getParagraphIndex();