mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-186750 Indent guides often disappear
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2017 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-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.
|
||||
|
||||
/*
|
||||
* @author max
|
||||
@@ -45,10 +43,8 @@ import com.intellij.util.text.CharArrayUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class IndentsPass extends TextEditorHighlightingPass implements DumbAware {
|
||||
private static final Key<List<RangeHighlighter>> INDENT_HIGHLIGHTERS_IN_EDITOR_KEY = Key.create("INDENT_HIGHLIGHTERS_IN_EDITOR_KEY");
|
||||
@@ -228,10 +224,14 @@ public class IndentsPass extends TextEditorHighlightingPass implements DumbAware
|
||||
int curRange = 0;
|
||||
|
||||
if (oldHighlighters != null) {
|
||||
// after document change some range highlighters could have become invalid, or the order could have been broken
|
||||
oldHighlighters.sort(Comparator.comparing((RangeHighlighter h) -> !h.isValid())
|
||||
.thenComparing(Segment.BY_START_OFFSET_THEN_END_OFFSET));
|
||||
int curHighlight = 0;
|
||||
while (curRange < myRanges.size() && curHighlight < oldHighlighters.size()) {
|
||||
TextRange range = myRanges.get(curRange);
|
||||
RangeHighlighter highlighter = oldHighlighters.get(curHighlight);
|
||||
if (!highlighter.isValid()) break;
|
||||
|
||||
int cmp = compare(range, highlighter);
|
||||
if (cmp < 0) {
|
||||
@@ -251,6 +251,7 @@ public class IndentsPass extends TextEditorHighlightingPass implements DumbAware
|
||||
|
||||
for (; curHighlight < oldHighlighters.size(); curHighlight++) {
|
||||
RangeHighlighter highlighter = oldHighlighters.get(curHighlight);
|
||||
if (!highlighter.isValid()) break;
|
||||
highlighter.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user