Skip to content

Commit dbe68a3

Browse files
Merge pull request #416 from JordanMartinez/linesCount
Add API: get # of lines a wrapped paragraph spans
2 parents 84bf47f + e2b85ed commit dbe68a3

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -799,6 +799,13 @@ TwoDimensional.Position _position(int par, int line) {
799799
return navigator.position(par, line);
800800
}
801801

802+
/**
803+
* Gets the number of lines a paragraph spans when {@link #isWrapText()} is true, or otherwise returns 1.
804+
*/
805+
public int getParagraphLinesCount(int paragraphIndex) {
806+
return virtualFlow.getCell(paragraphIndex).getNode().getLineCount();
807+
}
808+
802809
@Override
803810
public final String getText(int start, int end) {
804811
return model.getText(start, end);

0 commit comments

Comments
 (0)