How to get lines with selected text


I want to get lines selected in a java file.
I tried to do this with SelectionModel, but it's not very precise: it ignores collapsed lines - imports for example.
Do you know another approach that solves this issue

1 comment
Comment actions Permalink

SelectionModel.getStartOffset() and SelectionModel.getEndOffset() are absolutely precise and do not ignore anything. You may want to read about the difference between LogicalPosition and VisualPosition in the javadoc of the Editor class.


Please sign in to leave a comment.