Skip to content

Commit be7b9df

Browse files
Provide faster implementation of selectParagraph
1 parent 11e1e94 commit be7b9df

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

richtextfx/src/main/java/org/fxmisc/richtext/CaretSelectionBind.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,8 +322,9 @@ else if(pos >= sel.getEnd())
322322
void moveToAreaEnd(NavigationActions.SelectionPolicy selectionPolicy);
323323

324324
default void selectParagraph() {
325-
moveToParStart(NavigationActions.SelectionPolicy.CLEAR);
326-
moveToParEnd(NavigationActions.SelectionPolicy.ADJUST);
325+
int parStartPosition = getPosition() - getColumnPosition();
326+
int parEndPosition = parStartPosition + getArea().getParagraphLength(getParagraphIndex());
327+
selectRange(parStartPosition, parEndPosition);
327328
}
328329

329330
/**

0 commit comments

Comments
 (0)