diff --git a/src/editor/core/cm/selectionMarks.test.ts b/src/editor/core/cm/selectionMarks.test.ts index fa6b1b3937..4d73d102ad 100644 --- a/src/editor/core/cm/selectionMarks.test.ts +++ b/src/editor/core/cm/selectionMarks.test.ts @@ -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(); diff --git a/src/editor/core/cm/selectionMarks.ts b/src/editor/core/cm/selectionMarks.ts index 2b9737cecb..8e49bc0b39 100644 --- a/src/editor/core/cm/selectionMarks.ts +++ b/src/editor/core/cm/selectionMarks.ts @@ -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": { diff --git a/src/features/search/__tests__/controller.test.ts b/src/features/search/__tests__/controller.test.ts index 407b597118..af327675e2 100644 --- a/src/features/search/__tests__/controller.test.ts +++ b/src/features/search/__tests__/controller.test.ts @@ -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); }); diff --git a/src/features/search/everywhere/model.ts b/src/features/search/everywhere/model.ts index 1ec45cf1da..ae738b57d7 100644 --- a/src/features/search/everywhere/model.ts +++ b/src/features/search/everywhere/model.ts @@ -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;