mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-159829 when editing in find result previews the cursor jumps some number of characters after insertion
This commit is contained in:
@@ -27,6 +27,7 @@ import com.intellij.openapi.editor.impl.SettingsImpl;
|
||||
import com.intellij.openapi.editor.impl.softwrap.SoftWrapAppliancePlaces;
|
||||
import com.intellij.openapi.editor.markup.*;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.psi.*;
|
||||
@@ -51,6 +52,7 @@ public class UsagePreviewPanel extends UsageContextPanelBase implements DataProv
|
||||
private Editor myEditor;
|
||||
private final boolean myIsEditor;
|
||||
private int myLineHeight;
|
||||
private List<UsageInfo> myCachedSelectedUsageInfos;
|
||||
|
||||
public UsagePreviewPanel(@NotNull Project project, @NotNull UsageViewPresentation presentation) {
|
||||
this(project, presentation, false);
|
||||
@@ -118,7 +120,10 @@ public class UsagePreviewPanel extends UsageContextPanelBase implements DataProv
|
||||
validate();
|
||||
}
|
||||
|
||||
highlight(infos, myEditor, myProject, true, HighlighterLayer.ADDITIONAL_SYNTAX);
|
||||
if (!Comparing.equal(infos, myCachedSelectedUsageInfos)) { // avoid moving viewport
|
||||
highlight(infos, myEditor, myProject, true, HighlighterLayer.ADDITIONAL_SYNTAX);
|
||||
myCachedSelectedUsageInfos = infos;
|
||||
}
|
||||
}
|
||||
|
||||
public int getLineHeight() {
|
||||
@@ -217,6 +222,7 @@ public class UsagePreviewPanel extends UsageContextPanelBase implements DataProv
|
||||
if (myEditor != null) {
|
||||
EditorFactory.getInstance().releaseEditor(myEditor);
|
||||
myEditor = null;
|
||||
myCachedSelectedUsageInfos = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user