mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Zero-latency typing: handle carets in "virtual space"
This commit is contained in:
@@ -2186,6 +2186,7 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
|
||||
return myDocument instanceof DocumentImpl &&
|
||||
myHighlighter instanceof LexerEditorHighlighter &&
|
||||
!mySelectionModel.hasSelection() &&
|
||||
arePositionsWithinDocument(myCaretModel.getAllCarets()) &&
|
||||
areVisualLinesUnique(myCaretModel.getAllCarets()) &&
|
||||
!isInplaceRenamerActive() &&
|
||||
!KEY_CHARS_TO_SKIP.contains(c);
|
||||
@@ -2203,6 +2204,16 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
|
||||
return true;
|
||||
}
|
||||
|
||||
// Checks whether all the carets are within document or some of them are in a so called "virtual space".
|
||||
private boolean arePositionsWithinDocument(List<Caret> carets) {
|
||||
for (Caret caret : carets) {
|
||||
if (caret.getLogicalPosition().compareTo(offsetToLogicalPosition(caret.getOffset())) != 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// TODO Improve the approach - handle such cases in a more general way.
|
||||
private boolean isInplaceRenamerActive() {
|
||||
Key<?> key = Key.findKeyByName("EditorInplaceRenamer");
|
||||
|
||||
Reference in New Issue
Block a user