Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,13 @@ public class And_Text_Is_Not_Selected extends InlineCssTextAreaAppTest {

private String firstWord = "Some";
private String firstParagraph = firstWord + " text goes here";
private String secondWord = "More";
private String secondParagraph = secondWord + " text goes here";

@Override
public void start(Stage stage) throws Exception {
super.start(stage);
area.replaceText(firstParagraph);
area.replaceText(firstParagraph + "\n" + secondParagraph);
area.moveTo(0);
}

Expand All @@ -123,10 +125,17 @@ public void double_clicking_text_in_area_selects_closest_word() {
}

@Test
public void triple_clicking_line_in_area_selects_paragraph() {
tripleClickOnFirstLine();
public void triple_clicking_line_in_area_selects_paragraph()
throws InterruptedException, ExecutionException {

assertEquals(firstParagraph, area.getSelectedText());
int wordStart = firstParagraph.length() + 1;
Bounds bounds = asyncFx(
() -> area.getCharacterBoundsOnScreen(wordStart, wordStart + 1).get())
.get();

moveTo(bounds).doubleClickOn(PRIMARY).clickOn(PRIMARY);

assertEquals(secondParagraph, area.getSelectedText());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ public void moveToParStart() {

@Override
public void moveToParEnd() {
moveTo(area.getParagraphLength(getParagraphIndex()));
moveTo(getPosition() - getColumnPosition() + area.getParagraphLength(getParagraphIndex()));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,8 +322,9 @@ else if(pos >= sel.getEnd())
void moveToAreaEnd(NavigationActions.SelectionPolicy selectionPolicy);

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

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -409,8 +409,7 @@ public void moveToParStart(NavigationActions.SelectionPolicy selectionPolicy) {

@Override
public void moveToParEnd(NavigationActions.SelectionPolicy selectionPolicy) {
int newPos = getArea().getParagraphLength(getParagraphIndex());
moveTo(newPos, selectionPolicy);
moveTo(getPosition() - getColumnPosition() + getArea().getParagraphLength(getParagraphIndex()), selectionPolicy);
}

@Override
Expand Down