IJPL-449 Sticky lines: show visual indent line for selected or matched lines in new UI mode

GitOrigin-RevId: f46c39e88f70f583f380fb47eb0f7dca9e909912
This commit is contained in:
Aleksandr Trushev
2024-01-29 16:47:17 +00:00
committed by intellij-monorepo-bot
parent e99c8b5ea6
commit 9d303e0f9a
2 changed files with 10 additions and 5 deletions
@@ -18,6 +18,7 @@ import com.intellij.util.ObjectUtils;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.text.CharArrayUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.awt.*;
import java.util.List;
@@ -85,11 +86,11 @@ public class IndentGuideRenderer implements CustomHighlighterRenderer {
}
boolean selected = isSelected(editor, endOffset, startOffset, lineStartPosition.column);
if (!selected && editor instanceof EditorImpl editorImpl && editorImpl.isStickyLinePainting()) {
// suppress indent vertical lines on sticky lines panel
boolean stickyPainting = editor instanceof EditorImpl editorImpl && editorImpl.isStickyLinePainting();
Color color = getIndentColor(editor, startOffset, selected, stickyPainting);
if (color == null) {
return;
}
Color color = getIndentColor(editor, startOffset, selected);
int lineHeight = editor.getLineHeight();
Point start = editor.visualPositionToXY(lineStartPosition);
@@ -162,7 +163,7 @@ public class IndentGuideRenderer implements CustomHighlighterRenderer {
}
private static Color getIndentColor(Editor editor, int startOffset, boolean selected) {
private static @Nullable Color getIndentColor(Editor editor, int startOffset, boolean selected, boolean stickyPainting) {
EditorColorsScheme scheme = editor.getColorsScheme();
if (ExperimentalUI.isNewUI()) {
List<RangeHighlighter> highlighters = ContainerUtil.filter(editor.getMarkupModel().getAllHighlighters(),
@@ -179,6 +180,10 @@ public class IndentGuideRenderer implements CustomHighlighterRenderer {
}
}
}
if (!selected && stickyPainting) {
// suppress indent vertical lines on sticky lines panel
return null;
}
return scheme.getColor(selected ? EditorColors.SELECTED_INDENT_GUIDE_COLOR : EditorColors.INDENT_GUIDE_COLOR);
}
@@ -5662,7 +5662,7 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
}
/**
* If true, the editor is in special "clean" mode when editor's content is rendering on sticky lines panel.
* If true, the editor is in special "clean" mode when editor's content is being rendered on sticky lines panel.
* This allows suppressing visual elements like caret row background, vertical indent lines, right margin line, etc.
*/
@ApiStatus.Internal