The IDE you know, rebuilt in Rust. IntelliJ IDEA–style keymap, tool windows and search-everywhere in a fast native app: editor, code insight, debugger, Git, terminal, database and HTTP clients for 60+ languages.
TypeScript code-editorcross-platformdapdatabase-clientdebuggerdesktop-appdeveloper-toolsgithttp-clientideintellijlsprusttauriterminal
fix(vcs): cap the Push dialog's height so a long commit list scrolls inside it (#1491)
Jawbdf94926ec13
diff --git a/src/features/vcs/common.module.css b/src/features/vcs/common.module.cssindex cadf6f9d5..da45e6004 100644--- a/src/features/vcs/common.module.css+++ b/src/features/vcs/common.module.css@@ -111,6 +111,10 @@border-radius: var(--radius-small);}/* Push dialogs: the list fills the body so a resizable window shows more rows. */+.pushDialog > [data-dialog-body] {+ display: flex;+ flex-direction: column;+}.pushTreeWrap {flex: 1;min-height: 220px;@@ -127,6 +131,7 @@}/* Push dialogs: the outgoing commits' changed files below the commits, the diff beside them. */.pushChanges {+ flex: none;display: flex;flex-direction: column;min-height: 0;diff --git a/src/features/vcs/remoteUi.tsx b/src/features/vcs/remoteUi.tsxindex 63554591e..6bedffcd6 100644--- a/src/features/vcs/remoteUi.tsx+++ b/src/features/vcs/remoteUi.tsx@@ -149,6 +149,9 @@ interface PushNode {children?: PushNode[];}+// A long outgoing list scrolls inside the dialog instead of growing it to the screen (IDEA: 800×450 centre panel).+const PUSH_DIALOG_MAX_HEIGHT = 720;+function MultiPushDialog({ onClose }: { onClose: () => void }) {const roots = useVcs((s) => s.roots);const [repos, setRepos] = useState<RepoPush[] | null>(null);@@ -228,6 +231,8 @@ function MultiPushDialog({ onClose }: { onClose: () => void }) {title="Push Commits"onClose={onClose}width={repos?.some((r) => r.commits.length) ? 860 : 620}+ maxHeight={PUSH_DIALOG_MAX_HEIGHT}+ className={styles.pushDialog}resizable="both"footerStart={<>@@ -441,6 +446,8 @@ function PushDialog({ target: pushTarget, onClose }: { target: PushTarget; onClotitle={head ? tx`Push Commits to ${upstream ?? "remote"}` : "Push"}onClose={onClose}width={commits?.length ? 860 : 620}+ maxHeight={PUSH_DIALOG_MAX_HEIGHT}+ className={styles.pushDialog}resizable="both"footerStart={<>diff --git a/src/ui/Dialog.test.tsx b/src/ui/Dialog.test.tsxindex 7b5bef897..3a986495f 100644--- a/src/ui/Dialog.test.tsx+++ b/src/ui/Dialog.test.tsx@@ -168,6 +168,21 @@ describe("Dialog chrome", () => {expect([dialog.style.width, dialog.style.height]).toEqual(["600px", "400px"]);});+ it("caps a content-sized dialog at maxHeight until it is resized", () => {+ render(+ <Dialog open onClose={() => {}} title="Push" resizable="both" maxHeight={720}>+ <div>rows</div>+ </Dialog>,+ );+ const dialog = screen.getByRole("dialog");+ 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.style.maxHeight).toBe("");+ expect(dialog.style.height).not.toBe("");+ });+it("still drags a window dialog by its title bar", () => {render(<Dialog open onClose={() => {}} title="Usages Detected" buttons={safeDelete()} platform="other">diff --git a/src/ui/Dialog.tsx b/src/ui/Dialog.tsxindex 940c6e90f..8c488a585 100644--- a/src/ui/Dialog.tsx+++ b/src/ui/Dialog.tsx@@ -117,6 +117,8 @@ export interface DialogProps {resizable?: "both";minWidth?: number;minHeight?: number;+ /** Height cap while content-sized; a manual resize lifts it. */+ maxHeight?: number;/** Size to open at, such as one remembered from `onResized`; kept inside the window. */initialSize?: { w: number; h: number } | null;/** The size a resize ended at. */@@ -210,6 +212,7 @@ function DialogInner({resizable,minWidth,minHeight,+ maxHeight,initialSize,onResized,position = "center",@@ -392,6 +395,7 @@ function DialogInner({style={{width: size ? size.w : width,height: size?.h,+ maxHeight: !size && maxHeight ? `min(${maxHeight}px, 100%)` : undefined,translate: offset.x || offset.y ? `${offset.x}px ${offset.y}px` : undefined,}}>