mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-178809 Issue with sticky selection near the end of document
This commit is contained in:
@@ -458,7 +458,7 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
|
||||
@Override
|
||||
public void caretPositionChanged(CaretEvent e) {
|
||||
if (myStickySelection) {
|
||||
int selectionStart = Math.min(myStickySelectionStart, getDocument().getTextLength() - 1);
|
||||
int selectionStart = Math.min(myStickySelectionStart, getDocument().getTextLength());
|
||||
mySelectionModel.setSelection(selectionStart, myCaretModel.getVisualPosition(), myCaretModel.getOffset());
|
||||
}
|
||||
|
||||
|
||||
@@ -514,4 +514,11 @@ public class EditorImplTest extends AbstractEditorTest {
|
||||
assertFalse(inlay.isValid() && inlay.getOffset() == 1);
|
||||
assertFalse(region.isValid() && (region.getStartOffset() == 1 || region.getEndOffset() == 1));
|
||||
}
|
||||
|
||||
public void testStickySelectionAtDocumentEnd() {
|
||||
initText("ab<caret>");
|
||||
((EditorEx)myEditor).setStickySelection(true);
|
||||
left();
|
||||
checkResultByText("a<selection><caret>b</selection>");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user