diff --git a/src/features/search/__tests__/dialogs.test.tsx b/src/features/search/__tests__/dialogs.test.tsx
index 7060d6e26..c3cfa3a4d 100644
--- a/src/features/search/__tests__/dialogs.test.tsx
+++ b/src/features/search/__tests__/dialogs.test.tsx
@@ -87,6 +87,7 @@ beforeEach(() => {
useFindPopup.setState({ caseSensitive: false, wholeWord: false, isRegex: false });
localStorage.removeItem(TEXT_SEARCH_OPTIONS_KEY);
localStorage.removeItem(RECENT_FILES_SIZE_KEY);
+ localStorage.removeItem("openidea.search.everywhereSize.v1");
vi.mocked(openLocation).mockClear();
});
@@ -1027,3 +1028,46 @@ it("restarts a custom query restored before its debounce expires", async () => {
expect(screen.getByText("Fresh route")).toBeVisible();
act(remove);
});
+
+describe("Search Everywhere resize", () => {
+ it("is resizable, persists its size globally, and keeps that size when empty", async () => {
+ render();
+ act(() => showSearchEverywhere("all"));
+ await tick();
+
+ const dialog = screen.getByRole("dialog", { name: "Search Everywhere" });
+ expect(dialog).not.toHaveAttribute("data-resized");
+ expect(within(dialog).getByRole("separator", { name: "Resize" })).toBeInTheDocument();
+
+ fireEvent.pointerDown(within(dialog).getByRole("separator", { name: "Resize" }), {
+ button: 0,
+ clientX: 0,
+ clientY: 0,
+ });
+ fireEvent.pointerMove(window, { buttons: 1, clientX: 820, clientY: 520 });
+ fireEvent.pointerUp(window);
+
+ expect(dialog).toHaveAttribute("data-resized");
+ expect([dialog.style.width, dialog.style.height]).toEqual(["820px", "520px"]);
+ expect(JSON.parse(localStorage.getItem("openidea.search.everywhereSize.v1")!)).toEqual({ w: 820, h: 520 });
+
+ act(() => hideSearchEverywhere());
+ act(() => showSearchEverywhere("classes", { query: "" }));
+ await tick();
+
+ const reopened = screen.getByRole("dialog", { name: "Search Everywhere" });
+ expect(reopened).toHaveAttribute("data-resized");
+ expect([reopened.style.width, reopened.style.height]).toEqual(["820px", "520px"]);
+ });
+
+ it("clamps stored sizes to the minimum dimensions", async () => {
+ localStorage.setItem("openidea.search.everywhereSize.v1", JSON.stringify({ w: 200, h: 100 }));
+ render();
+ act(() => showSearchEverywhere("classes", { query: "" }));
+ await tick();
+
+ const dialog = screen.getByRole("dialog", { name: "Search Everywhere" });
+ expect(dialog).toHaveAttribute("data-resized");
+ expect([dialog.style.width, dialog.style.height]).toEqual(["480px", "240px"]);
+ });
+});
diff --git a/src/features/search/everywhere/SearchEverywhere.module.css b/src/features/search/everywhere/SearchEverywhere.module.css
index 4027cc4a4..2baaafb4d 100644
--- a/src/features/search/everywhere/SearchEverywhere.module.css
+++ b/src/features/search/everywhere/SearchEverywhere.module.css
@@ -147,11 +147,26 @@
/* `auto`, not `1`: without the preview `.content` has no definite height, and a 0% basis there
collapses the list in the system WebKit of macOS 15 instead of using its inline height. */
flex: 1 1 auto;
+ height: var(--se-list-height, auto);
min-height: 0;
display: flex;
flex-direction: column;
padding: 0 0 8px;
}
+.dialog[data-resized] {
+ max-height: calc(100vh - 24px);
+}
+.dialog[data-resized] .content {
+ flex: 1 1 0%;
+ min-height: 0;
+}
+.dialog[data-resized] .withPreview {
+ height: auto;
+}
+.dialog[data-resized] .results {
+ flex: 1 1 0%;
+ height: auto;
+}
.list {
flex: 1;
min-height: 0;
@@ -296,7 +311,7 @@
align-items: center;
gap: 14px;
height: 30px;
- padding: 0 12px;
+ padding: 0 20px 0 12px;
background: var(--se-bg-header);
border-top: 1px solid var(--border-popup);
color: var(--fg-subtle);
diff --git a/src/features/search/everywhere/SearchEverywhere.tsx b/src/features/search/everywhere/SearchEverywhere.tsx
index b6fb476c3..3232a5daa 100644
--- a/src/features/search/everywhere/SearchEverywhere.tsx
+++ b/src/features/search/everywhere/SearchEverywhere.tsx
@@ -2,7 +2,7 @@ import { writeClipboardText } from "@/platform/clipboard";
import { onSearchCategoriesChanged, onEndpointsChanged } from "@/workbench/contributions";
import { useFilePresentation } from "@/ui/filePresentation";
import { useRowHeight } from "@/ui/density";
-import { useEffect, useMemo, useRef, useState, type KeyboardEvent, type MouseEvent } from "react";
+import { useEffect, useMemo, useRef, useState, type CSSProperties, type KeyboardEvent, type MouseEvent } from "react";
import clsx from "clsx";
import { actionToggled, executeAction, executeActionFrom, getAction } from "@/platform/actions";
import { onIdeEvent, type ProjectFileSet } from "@/platform/ipc";
@@ -66,10 +66,14 @@ import {
type SectionId,
} from "./model";
import {
+ SE_MIN_HEIGHT,
+ SE_MIN_WIDTH,
hideSearchEverywhere,
+ loadSearchEverywhereSize,
onSearchEverywhereQuery,
pushRecentAction,
pushSearchHistory,
+ saveSearchEverywhereSize,
searchHistory,
selectSearchEverywhereTab,
setIncludeNonProject,
@@ -134,6 +138,7 @@ const INITIAL_SELECTION: Selection = { key: null, anchorKey: null, lead: -1, anc
function SearchEverywhereDialog() {
const tx = useTx();
const rowHeight = useRowHeight(ROW);
+ const [initialSize] = useState(loadSearchEverywhereSize);
const tab = useSearchEverywhere((s) => s.tab);
const hint = hintFor(tab, tx);
const [tabs, setTabs] = useState(searchTabs);
@@ -586,7 +591,7 @@ function SearchEverywhereDialog() {
{rows.length > 0 && (
@@ -643,6 +648,11 @@ function SearchEverywhereDialog() {
open
onClose={close}
width={700}
+ resizable="both"
+ minWidth={SE_MIN_WIDTH}
+ minHeight={SE_MIN_HEIGHT}
+ initialSize={initialSize}
+ onResized={saveSearchEverywhereSize}
position="top"
transparentBackdrop
aria-label={tx("Search Everywhere")}
diff --git a/src/features/search/everywhere/store.ts b/src/features/search/everywhere/store.ts
index 4d54ee554..1a794d877 100644
--- a/src/features/search/everywhere/store.ts
+++ b/src/features/search/everywhere/store.ts
@@ -31,6 +31,20 @@ interface SeState {
const PREVIEW_KEY = "openidea.search.everywherePreview.v1";
const FILTERS_KEY = "openidea.search.everywhereFilters.v1";
+const SIZE_KEY = "openidea.search.everywhereSize.v1";
+export const SE_MIN_WIDTH = 480;
+export const SE_MIN_HEIGHT = 240;
+
+export function loadSearchEverywhereSize(): { w: number; h: number } | null {
+ const v = loadJson<{ w?: unknown; h?: unknown } | null>(SIZE_KEY, null);
+ return typeof v?.w === "number" && typeof v.h === "number" && Number.isFinite(v.w + v.h) && v.w > 0 && v.h > 0
+ ? { w: Math.max(SE_MIN_WIDTH, v.w), h: Math.max(SE_MIN_HEIGHT, v.h) }
+ : null;
+}
+
+export function saveSearchEverywhereSize(size: { w: number; h: number }) {
+ saveJson(SIZE_KEY, size);
+}
export const useSearchEverywhere = create(() => ({
open: false,
diff --git a/src/ui/Dialog.module.css b/src/ui/Dialog.module.css
index 2c8ee0b2e..b442f135b 100644
--- a/src/ui/Dialog.module.css
+++ b/src/ui/Dialog.module.css
@@ -49,6 +49,7 @@
position: absolute;
right: 0;
bottom: 0;
+ z-index: 2;
width: 16px;
height: 16px;
cursor: nwse-resize;
@@ -69,6 +70,60 @@
.resizeGrip:hover {
opacity: 1;
}
+.resizeEdge {
+ position: absolute;
+ z-index: 2;
+ touch-action: none;
+}
+.resizeN {
+ top: 0;
+ left: 10px;
+ right: 10px;
+ height: 4px;
+ cursor: ns-resize;
+}
+.resizeS {
+ bottom: 0;
+ left: 10px;
+ right: 16px;
+ height: 4px;
+ cursor: ns-resize;
+}
+.resizeW {
+ left: 0;
+ top: 10px;
+ bottom: 10px;
+ width: 4px;
+ cursor: ew-resize;
+}
+.resizeE {
+ right: 0;
+ top: 10px;
+ bottom: 16px;
+ width: 4px;
+ cursor: ew-resize;
+}
+.resizeNW {
+ top: 0;
+ left: 0;
+ width: 10px;
+ height: 10px;
+ cursor: nwse-resize;
+}
+.resizeNE {
+ top: 0;
+ right: 0;
+ width: 10px;
+ height: 10px;
+ cursor: nesw-resize;
+}
+.resizeSW {
+ bottom: 0;
+ left: 0;
+ width: 10px;
+ height: 10px;
+ cursor: nesw-resize;
+}
/* Title bar (drag handle). macOS: traffic lights then the title; else title + close. */
.titleBar {
diff --git a/src/ui/Dialog.test.tsx b/src/ui/Dialog.test.tsx
index 1ce87db9a..d0c57d462 100644
--- a/src/ui/Dialog.test.tsx
+++ b/src/ui/Dialog.test.tsx
@@ -176,14 +176,144 @@ describe("Dialog chrome", () => {
,
);
const dialog = screen.getByRole("dialog");
+ expect(dialog).not.toHaveAttribute("data-resized");
expect(dialog.style.maxHeight).toBe("min(720px, 100%)");
fireEvent.pointerDown(screen.getByRole("separator", { name: "Resize" }), { button: 0, clientX: 0, clientY: 0 });
fireEvent.pointerMove(window, { buttons: 1, clientX: 500, clientY: 800 });
fireEvent.pointerUp(window);
+ expect(dialog).toHaveAttribute("data-resized");
expect(dialog.style.maxHeight).toBe("");
expect(dialog.style.height).not.toBe("");
});
+ it("resizes from the left edge without shifting the right edge or changing height", () => {
+ const onResized = vi.fn();
+ render(
+ ,
+ );
+ const dialog = screen.getByRole("dialog");
+ vi.spyOn(dialog, "getBoundingClientRect").mockReturnValue({
+ x: 200,
+ y: 50,
+ left: 200,
+ top: 50,
+ right: 600,
+ bottom: 350,
+ width: 400,
+ height: 300,
+ toJSON: () => ({}),
+ });
+ const west = dialog.querySelector('[data-resize="w"]') as HTMLElement;
+ fireEvent.pointerDown(west, { button: 0, clientX: 200, clientY: 150 });
+ fireEvent.pointerMove(window, { buttons: 1, clientX: 120, clientY: 150 });
+ fireEvent.pointerUp(window);
+ expect([dialog.style.width, dialog.style.height]).toEqual(["480px", "300px"]);
+ expect(dialog.style.translate).toBe("-40px 0px");
+ expect(onResized).toHaveBeenCalledExactlyOnceWith({ w: 480, h: 300 });
+ });
+
+ it("resizes from the top edge for both top popups and centered dialogs without dragging", () => {
+ const onResizedTop = vi.fn();
+ const { unmount } = render(
+ ,
+ );
+ const topDialog = screen.getByRole("dialog");
+ vi.spyOn(topDialog, "getBoundingClientRect").mockReturnValue({
+ x: 200,
+ y: 120,
+ left: 200,
+ top: 120,
+ right: 600,
+ bottom: 420,
+ width: 400,
+ height: 300,
+ toJSON: () => ({}),
+ });
+ const topNorth = topDialog.querySelector('[data-resize="n"]') as HTMLElement;
+ fireEvent.pointerDown(topNorth, { button: 0, clientX: 300, clientY: 120 });
+ fireEvent.pointerMove(window, { buttons: 1, clientX: 350, clientY: 70 });
+ fireEvent.pointerUp(window);
+ expect([topDialog.style.width, topDialog.style.height]).toEqual(["400px", "350px"]);
+ expect(topDialog.style.translate).toBe("0px -50px");
+ expect(onResizedTop).toHaveBeenCalledExactlyOnceWith({ w: 400, h: 350 });
+ unmount();
+
+ const onResizedCenter = vi.fn();
+ render(
+ ,
+ );
+ const centerDialog = screen.getByRole("dialog");
+ vi.spyOn(centerDialog, "getBoundingClientRect").mockReturnValue({
+ x: 200,
+ y: 150,
+ left: 200,
+ top: 150,
+ right: 600,
+ bottom: 450,
+ width: 400,
+ height: 300,
+ toJSON: () => ({}),
+ });
+ const centerNorth = centerDialog.querySelector('[data-resize="n"]') as HTMLElement;
+ fireEvent.pointerDown(centerNorth, { button: 0, clientX: 300, clientY: 150 });
+ fireEvent.pointerMove(window, { buttons: 1, clientX: 350, clientY: 90 });
+ fireEvent.pointerUp(window);
+ expect([centerDialog.style.width, centerDialog.style.height]).toEqual(["400px", "360px"]);
+ expect(centerDialog.style.translate).toBe("0px -30px");
+ expect(onResizedCenter).toHaveBeenCalledExactlyOnceWith({ w: 400, h: 360 });
+ });
+
+ it("marks data-resized when opened with initialSize", () => {
+ render(
+ ,
+ );
+ expect(screen.getByRole("dialog")).toHaveAttribute("data-resized");
+ });
+
it("still drags a window dialog by its title bar", () => {
render(
,
diff --git a/src/ui/dragCursor.ts b/src/ui/dragCursor.ts
index a398ff018..b04067b20 100644
--- a/src/ui/dragCursor.ts
+++ b/src/ui/dragCursor.ts
@@ -1,4 +1,11 @@
-export type DragCursor = "move" | "col-resize" | "row-resize" | "ew-resize" | "ns-resize" | "nwse-resize";
+export type DragCursor =
+ | "move"
+ | "col-resize"
+ | "row-resize"
+ | "ew-resize"
+ | "ns-resize"
+ | "nwse-resize"
+ | "nesw-resize";
const active = new Set<() => void>();
let listening = false;