fix(editor): keep selected text visible over highlighted ranges (#1454)

The selection is drawn in a layer behind the text, so any range with its own background (find
matches, warnings in light schemes, usages, semantic backgrounds) hid it: selected text there
kept its yellow or other highlight. Selected text is now also marked in the innermost span with
the selection colour, in text editors, notebook cells and the VCS viewers.
Цей коміт міститься в:
l0ng-ai authored and GitHub committed 2026-11-05 12:50:25 +08:00
1 джерело 4a90f124c6
коміт 7856fabbfe
5 files changed
+112 -3

No files matched your search

+2
Переглянути файл
@@ -12,6 +12,7 @@ import { defaultKeymap, indentWithTab } from "@codemirror/commands";
import { bracketMatching, indentOnInput, syntaxHighlighting } from "@codemirror/language";
import { openideaTheme } from "@/editor/core/cm/theme";
import { openideaHighlightStyle } from "@/editor/core/cm/highlight";
import { selectionMarks } from "@/editor/core/cm/selectionMarks";
import { findLanguageDescription, loadSupport } from "@/editor/core/cm/languages";
import { tx } from "@/platform/i18n";
import type { NotebookSession } from "./session";
@@ -43,6 +44,7 @@ export function CellEditor({
syntaxHighlighting(openideaHighlightStyle),
lineNumbers(),
drawSelection(),
selectionMarks,
highlightActiveLine(),
highlightSpecialChars(),
bracketMatching(),
+4 -3
Переглянути файл
@@ -270,9 +270,10 @@ export const viewerTheme = EditorView.theme(
"&.cm-openidea-ligatures .cm-scroller": { fontVariantLigatures: "normal" },
".cm-content": { caretColor: "var(--caret, var(--fg-strong))", WebkitUserSelect: "text", userSelect: "text" },
...caretStyles,
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, ::selection": {
backgroundColor: "var(--bg-selected-strong)",
},
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, ::selection, .cm-openidea-selected, &.cm-focused .cm-openidea-selected":
{
backgroundColor: "var(--bg-selected-strong)",
},
".cm-activeLine": { backgroundColor: "var(--bg-current-line)" },
".cm-gutters": {
backgroundColor: "var(--bg-app)",