boolean (char c, PsiFile file, Editor editor) { if (myReplacement == null) { return false; } Document document = editor.getDocument(); CaretModel caretModel = editor.getCaretModel(); int endOffset = CharArrayUtil.shiftForward(document.getImmutableCharSequence(), caretModel.getOffset(), " \t"); if (editor instanceof EditorWindow) { List<TextRange> ranges = InjectedLanguageManager.getInstance(file.getProject()) .intersectWithAllEditableFragments(file, new TextRange(myStartOffset, endOffset)); if (ranges.size() != 1 || !ranges.get(0).equalsToRange(myStartOffset, endOffset)) return false; } document.replaceString(myStartOffset, endOffset, myReplacement); caretModel.moveToOffset(myStartOffset + myReplacement.length()); return true; }