Skip to content

Triple click doesn't select paragraph; CaretSelectionBindImpl.moveToParEnd wrongly calculates position #742

@alesp

Description

@alesp

Triple clicking a paragraph should select it. This works fine if you triple click the first paragraph. If you click any other paragraph, it will select some text before that paragraph.

This could be due to the fact that CaretSelectionBindImpl.moveToParEnd doesn't take into account that the cursor may not be in the first paragraph. It calculates new position as:

int newPos = getArea().getParagraphLength(getParagraphIndex());

This position is ok relative to the current paragraph, but the next line (moveTo) apparently expects absolute position:

moveTo(newPos, selectionPolicy);

Compare that with moveTo in moveToParStart:

moveTo(getPosition() - getColumnPosition(), selectionPolicy);

In other words, moveTo in moveToParEnd should probably be:

moveTo(newPos + getPosition() - getColumnPosition(), selectionPolicy);

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions