дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-06 18:17:15 +02:00
Under the modal commit interface, Show Diff in New Window opened the diff window but left the front diff dialog open, so the same diff showed twice. showDiffWindow now resolves once the window is on its way and the action closes the open diff dialog; it stays when the window cannot open. On Windows and Linux the diff window's frameless title bar also gets the maximize button beside close. Refs #7675 Co-authored-by: muutot <[email protected]>
24 рядки
967 B
TypeScript
24 рядки
967 B
TypeScript
import type { WindowButton, WindowButtonLayout } from "@/platform/ipc";
|
|
|
|
export type Side = "left" | "right";
|
|
|
|
/** A dialog keeps its close button even where the layout leaves close out, on the side the buttons go. */
|
|
function closeSide(layout: WindowButtonLayout): Side {
|
|
if (layout.left.includes("close")) return "left";
|
|
if (layout.right.includes("close") || layout.right.length > 0) return "right";
|
|
return layout.left.length > 0 ? "left" : "right";
|
|
}
|
|
|
|
/** The caption buttons on one side of a frameless title bar, left to right. Dialogs only have close. */
|
|
export function captionButtons(
|
|
layout: WindowButtonLayout,
|
|
side: Side,
|
|
dialog = false,
|
|
maximize = false,
|
|
): WindowButton[] {
|
|
if (!dialog) return layout[side];
|
|
if (closeSide(layout) !== side) return [];
|
|
// A maximizable dialog (the diff window) keeps maximize beside its close button.
|
|
return maximize ? (side === "right" ? ["maximize", "close"] : ["close", "maximize"]) : ["close"];
|
|
}
|