add and use EditorUtil#inVirtualSpace(Editor)

GitOrigin-RevId: 05a9779f2ff2bf0ffa37c6035875809e4fa2d4ce
This commit is contained in:
Daniil Ovchinnikov
2019-07-02 06:52:16 +03:00
committed by intellij-monorepo-bot
parent 81d3b01f14
commit 4a0f9fa272
2 changed files with 7 additions and 2 deletions
@@ -1,4 +1,4 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.codeInsight.daemon.impl;
@@ -14,6 +14,7 @@ import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.ex.EditorEx;
import com.intellij.openapi.editor.ex.util.EditorUtil;
import com.intellij.openapi.editor.impl.DocumentMarkupModel;
import com.intellij.openapi.editor.markup.MarkupModel;
import com.intellij.openapi.editor.markup.RangeHighlighter;
@@ -214,7 +215,7 @@ public class IdentifierHighlighterPass extends TextEditorHighlightingPass {
@Override
public void doApplyInformationToEditor() {
final boolean virtSpace = TargetElementUtil.inVirtualSpace(myEditor, myEditor.getCaretModel().getOffset());
final boolean virtSpace = EditorUtil.inVirtualSpace(myEditor);
final List<HighlightInfo> infos = virtSpace || isCaretOverCollapsedFoldRegion() ? Collections.emptyList() : getHighlights();
UpdateHighlightersUtil.setHighlightersToEditor(myProject, myDocument, 0, myFile.getTextLength(), infos, getColorsScheme(), getId());
doAdditionalCodeBlockHighlighting();
@@ -639,6 +639,10 @@ public final class EditorUtil {
: e.isControlDown() && !e.isMetaDown() && !e.isAltDown() && !e.isShiftDown();
}
public static boolean inVirtualSpace(@NotNull Editor editor) {
return inVirtualSpace(editor, editor.getCaretModel().getLogicalPosition());
}
public static boolean inVirtualSpace(@NotNull Editor editor, @NotNull LogicalPosition logicalPosition) {
return !editor.offsetToLogicalPosition(editor.logicalPositionToOffset(logicalPosition)).equals(logicalPosition);
}