fix(editor): keep the current find match readable, show more Search Everywhere results (#8007)

Find selects the current match, and the selection is repainted inside the match's own mark. The selected text kept the match's foreground, meant for the yellow match fill, so on a dark theme the current match was dark text on the blue selection. Selected text inside a find match now takes the scheme's selection foreground, or the editor's when the scheme sets none.

The All tab of Search Everywhere showed 6 results per group before "more"; it now shows 15, as many as each "more" adds.

Fixes #7972
Цей коміт міститься в:
l0ng-ai authored and GitHub committed 2026-12-04 17:39:59 +08:00
1 джерело b4c8a6708c
коміт f2b602a48e
4 files changed
+19 -5

No files matched your search

+8
Переглянути файл
@@ -49,6 +49,14 @@ describe("selectionMarks", () => {
expect(inMatch.map((e) => e.textContent).join("")).toBe(DOC.slice(15, 20));
});
it("gives selected text inside a find match the selection's or the editor's foreground, not the match's", () => {
view(DOC, EditorSelection.single(15, 20), [backgroundMark("cm-openidea-findMatch", 15, 24), selectionMarks]);
const css = [...document.querySelectorAll("style")].map((s) => s.textContent).join("\n");
const rule = /[^{}]*\.cm-openidea-findMatch \.cm-openidea-selected\s*\{([^}]*)\}/.exec(css)?.[1] ?? "";
expect(rule).toContain("color: var(--fg-editor-selection, var(--fg-editor))");
expect(rule).toContain("-webkit-text-fill-color: var(--fg-editor-selection, var(--fg-editor))");
});
it("adds nothing for an empty selection and clears when the selection collapses", () => {
const v = view(DOC, EditorSelection.single(0, 6), [selectionMarks]);
expect(v.contentDOM.querySelector(".cm-openidea-selected")).not.toBeNull();
+6
Переглянути файл
@@ -47,6 +47,12 @@ const theme = EditorView.baseTheme({
"&.cm-focused .cm-openidea-selected": {
"--openidea-selected-bg": "var(--editor-selection, var(--bg-editor-selection))",
},
// A find match's own foreground goes with its fill (dark text on yellow): over the selection's
// fill, selected text takes the selection foreground, or the editor's when the scheme sets none.
".cm-openidea-findMatch .cm-openidea-selected": {
color: "var(--fg-editor-selection, var(--fg-editor))",
WebkitTextFillColor: "var(--fg-editor-selection, var(--fg-editor))",
},
// Leave the 1px frame painted by `inlineFramedModern` visible around selected text inside it.
"@supports (height: 1lh)": {
":is(.cm-openidea-findMatch-current, .cm-lsp-inplace-primary) .cm-openidea-selected": {
+4 -4
Переглянути файл
@@ -247,7 +247,7 @@ describe("SeController", () => {
c.run({ query: "a", tab: "all", includeNonProject: false, extra: { files: 15 } });
await flush();
expect(findFiles).toHaveBeenCalledTimes(2);
expect(findFiles).toHaveBeenLastCalledWith("a", 22);
expect(findFiles).toHaveBeenLastCalledWith("a", 31);
expect(findSymbols).toHaveBeenCalledTimes(2); // classes + symbols once each
});
@@ -301,8 +301,8 @@ describe("SeController", () => {
it("streams text matches up to the limit", async () => {
const searchText = vi.fn(async (_id: number, q: SearchQuery, onFile: (f: FileMatches) => void) => {
expect(q.maxMatches).toBe(7);
for (let i = 0; i < 3; i++)
expect(q.maxMatches).toBe(16);
for (let i = 0; i < 6; i++)
onFile({
path: `/p/${i}.kt`,
relPath: `${i}.kt`,
@@ -313,7 +313,7 @@ describe("SeController", () => {
c.run({ query: "order", tab: "all", includeNonProject: false, extra: {} });
await flush();
const text = last().sections.get("text")!;
expect(text.items).toHaveLength(6);
expect(text.items).toHaveLength(15);
expect(text.hasMore).toBe(true);
expect(text.loading).toBe(false);
});
+1 -1
Переглянути файл
@@ -80,7 +80,7 @@ export function sectionsFor(tab: SeTab, emptyQuery: boolean): SectionId[] {
return tab === "all" ? ["classes", "files", "symbols", "endpoints", "actions", "text"] : [tab];
}
export const ALL_TAB_LIMIT = 6;
export const ALL_TAB_LIMIT = 15;
export const TAB_LIMIT = 50;
export const MORE_STEP_ALL = 15;
export const MORE_STEP_TAB = 50;