File tree Expand file tree Collapse file tree
integrationTest/java/org/fxmisc/richtext/mouse
main/java/org/fxmisc/richtext Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -93,11 +93,13 @@ public class And_Text_Is_Not_Selected extends InlineCssTextAreaAppTest {
9393
9494 private String firstWord = "Some" ;
9595 private String firstParagraph = firstWord + " text goes here" ;
96+ private String secondWord = "More" ;
97+ private String secondParagraph = secondWord + " text goes here" ;
9698
9799 @ Override
98100 public void start (Stage stage ) throws Exception {
99101 super .start (stage );
100- area .replaceText (firstParagraph );
102+ area .replaceText (firstParagraph + " \n " + secondParagraph );
101103 area .moveTo (0 );
102104 }
103105
@@ -123,10 +125,17 @@ public void double_clicking_text_in_area_selects_closest_word() {
123125 }
124126
125127 @ Test
126- public void triple_clicking_line_in_area_selects_paragraph () {
127- tripleClickOnFirstLine ();
128+ public void triple_clicking_line_in_area_selects_paragraph ()
129+ throws InterruptedException , ExecutionException {
128130
129- assertEquals (firstParagraph , area .getSelectedText ());
131+ int wordStart = firstParagraph .length () + 1 ;
132+ Bounds bounds = asyncFx (
133+ () -> area .getCharacterBoundsOnScreen (wordStart , wordStart + 1 ).get ())
134+ .get ();
135+
136+ moveTo (bounds ).doubleClickOn (PRIMARY ).clickOn (PRIMARY );
137+
138+ assertEquals (secondParagraph , area .getSelectedText ());
130139 }
131140
132141 @ Test
Original file line number Diff line number Diff line change @@ -266,7 +266,7 @@ public void moveToParStart() {
266266
267267 @ Override
268268 public void moveToParEnd () {
269- moveTo (area .getParagraphLength (getParagraphIndex ()));
269+ moveTo (getPosition () - getColumnPosition () + area .getParagraphLength (getParagraphIndex ()));
270270 }
271271
272272 @ Override
Original file line number Diff line number Diff 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 /**
Original file line number Diff line number Diff line change @@ -409,8 +409,7 @@ public void moveToParStart(NavigationActions.SelectionPolicy selectionPolicy) {
409409
410410 @ Override
411411 public void moveToParEnd (NavigationActions .SelectionPolicy selectionPolicy ) {
412- int newPos = getArea ().getParagraphLength (getParagraphIndex ());
413- moveTo (newPos , selectionPolicy );
412+ moveTo (getPosition () - getColumnPosition () + getArea ().getParagraphLength (getParagraphIndex ()), selectionPolicy );
414413 }
415414
416415 @ Override
You can’t perform that action at this time.
0 commit comments