Порівняти коміти

..
Автор SHA1 Повідомлення Дата
l0ng-ai 989a93ace8 fix(refactor): type a chained call by its last call in Introduce Variable
When the code has errors (e.g. a statement without its semicolon), Introduce
Variable falls back to a syntax-based declaration and types it from the hover
of the call the expression ends in. That call was found with a greedy regex,
so in `demo.getList().get(0)` the argument list swallowed `().get(0)` and
the hover of `getList` typed the variable as `List<String>`. The trailing
call is now found by matching its parentheses.

Fixes #2509
2026-11-10 23:30:41 +08:00
Clarence a60293929a fix(ui): the main menu button follows the tool window stripe (#2538)
On Windows and Linux the main menu button's size, slot and the frameless bar's left padding were hardcoded, so the button sat 6px right of the stripe icons below it and stayed 30px in compact mode. It now reads the stripe tokens and uses the 20px glyph of the other title bar tool buttons.

Co-authored-by: Clarence404 <[email protected]>
2026-11-10 23:16:39 +08:00
Ernstjan FreriksтаEjaYF 284a287a0f fix(ui): keep dialogs below the macOS window buttons (#2523)
With the overlay title bar, macOS draws the window buttons over the page, so a tall dialog (e.g. Push) or one dragged to the top edge had its title bar covered. The dialog layer now keeps a top margin of at least the title bar height on macOS, and dragging stops there. Windows and Linux are unchanged.

Co-authored-by: EjaYF <[email protected]>
2026-11-10 23:16:32 +08:00
Muuтаmuutot a58e3a45f0 fix(vcs): offer both ignore destinations in the changes view (#2499)
Add to .gitignore in the changes view is now a submenu with .gitignore and .git/info/exclude, as in the project view's Git menu, and the file the rule was written to opens in both cases.

Co-authored-by: muutot <[email protected]>
2026-11-10 23:16:24 +08:00
Moler1995 ca9cc64ee8 fix(plugins): keep line-marker gutter icons inside their column (#2481)
Line-marker buttons reuse the indexed-marker button class, whose theme sized every icon to 16px; in the 14px line-marker column, which clips to its width, every icon lost a pixel column on both sides. The 16px size now applies only inside the indexed-marker gutter.

Fixes #2479

{
  "message": "Not Found",
  "documentation_url": "https://docs.github.com/rest",
  "status": "404"
}
2026-11-10 23:16:16 +08:00
xtr-hubтаxtr-hub 8b32df9773 fix(archive): handle multibyte ZIP paths on Windows (#2516)
zip 9.1.3's reserved-device-name check sliced entry names at byte offsets, so a WAR or tool archive with a multi-byte file name (e.g. `ZC机柜.jpg`) panicked with "end byte index is not a char boundary" on Windows. Raise zip to 9.2.3, which checks on character boundaries; this covers Tomcat WAR deployment and ZIP/VSIX tool extraction, the two enclosed_name callers.

Fixes #2456

Co-authored-by: xtr-hub <[email protected]>
2026-11-10 23:14:04 +08:00
l0ng-ai 636b2e1572 fix(vcs): handle repositories nested below a non-Git project root (#2546)
- Project view: the Git submenu was gated on the project root being a
  repository, so it never appeared when the repositories are found later
  below a non-Git root. It now also follows the VCS availability that the
  Commit tool window uses.
- Commit: when only one repository had included changes, every staged but
  excluded file of every repository was passed to it, and the commit failed
  with "<path> is outside the repository". Paths that belong to another known
  repository are now left to that repository.

Fixes #2517
Fixes #2518
2026-11-10 23:09:35 +08:00
l0ng-ai 834a54c69b fix(boot): keep starting after an unhandled rejection (#2545)
The startup failure screen treated every unhandled promise rejection before
the workbench was ready as fatal. A rejected background request (WebKit
reports it as "TypeError: Load failed") then stopped startup on machines
where the app had started fine before. Such a rejection is now remembered and
only reported if startup also times out.

Errors without a stack (WebKit's network TypeErrors) were serialised with
JSON.stringify and showed as "{}"; they now show their name and message.

Fixes #2445
2026-11-10 23:03:52 +08:00
arookieofc 9cb8aed512 fix(run): retry the port-file read in stop_tree tests (#2541) 2026-11-10 23:01:28 +08:00
23 змінених файлів з 324 додано та 36 видалено

No files matched your search

Створено
+3 -2
Переглянути файл
@@ -12152,14 +12152,15 @@ dependencies = [
[[package]]
name = "zip"
version = "9.1.3"
version = "9.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1156b39d142a34b999c2310a50455e0cb3760bf7efad0122f796d813bee26ccb"
checksum = "00fb4744e923442ecadfd3f85f51a5d24e03bf43d53813b81ebb4c91d02baa62"
dependencies = [
"crc32fast",
"flate2",
"getrandom 0.4.3",
"indexmap 2.14.2",
"libc",
"memchr",
"nix 0.31.3",
"typed-path",
+1 -1
Переглянути файл
@@ -82,7 +82,7 @@ trash = "5"
blake3 = "1"
dunce = "1"
dirs = "6"
zip = { version = "9", default-features = false, features = ["deflate"] }
zip = { version = "9.2.3", default-features = false, features = ["deflate"] }
# search, index, language
grep-searcher = "0.1"
+42
Переглянути файл
@@ -1228,6 +1228,48 @@ mod tests {
}
zip.finish().unwrap();
}
#[test]
fn explodes_wars_with_multibyte_path_components() {
let tmp = tempfile::tempdir().unwrap();
let war = tmp.path().join("app.war");
let entries = [
("bdms300-front/dist/img/ZC机柜.jpg", "reported case"),
("img/A机柜.jpg", "one ASCII byte"),
("img/😀.jpg", "four-byte character"),
("img/abé.jpg", "two-byte character"),
("ZC机柜/index.jsp", "multibyte directory"),
("img/普通.jpg", "character boundary"),
];
archive(&war, &entries);
for resources_only in [false, true] {
let destination = tmp.path().join(format!("out-{resources_only}"));
explode(&war, &destination, resources_only).unwrap();
for (name, text) in entries {
assert_eq!(fs::read_to_string(destination.join(name)).unwrap(), text, "{name}");
}
}
}
#[test]
fn rejects_war_path_traversal() {
let tmp = tempfile::tempdir().unwrap();
let war = tmp.path().join("app.war");
archive(&war, &[("../escape.txt", "outside")]);
assert!(explode(&war, &tmp.path().join("out"), false).is_err());
assert!(!tmp.path().join("escape.txt").exists());
}
#[cfg(windows)]
#[test]
fn rejects_war_reserved_device_paths() {
let tmp = tempfile::tempdir().unwrap();
let war = tmp.path().join("app.war");
for name in ["CON.txt", "NUL", "COM1.txt", "LPT¹", "img/aux.jpg"] {
archive(&war, &[(name, "device")]);
assert!(explode(&war, &tmp.path().join("out"), false).is_err(), "{name}");
}
}
#[test]
fn keeps_the_apps_own_context_descriptor() {
let tmp = tempfile::tempdir().unwrap();
+9 -2
Переглянути файл
@@ -99,8 +99,15 @@ fn config(line: &str) -> RunConfig {
}
fn holder_port(dir: &std::path::Path) -> u16 {
wait_for("the holder's port", || std::fs::metadata(dir.join("port")).is_ok());
std::fs::read_to_string(dir.join("port")).unwrap().trim().parse().unwrap()
// The file appears as soon as the holder creates it, before the port is written and
// the handle closed: on a loaded machine (defender, indexer) the first reads can hit
// a sharing violation or a partial write, so keep reading until it parses.
let mut port = None;
wait_for("the holder's port", || {
port = std::fs::read_to_string(dir.join("port")).ok().and_then(|s| s.trim().parse().ok());
port.is_some()
});
port.unwrap()
}
#[test]
+18
Переглянути файл
@@ -443,6 +443,24 @@ mod tests {
}
}
#[test]
fn extracts_zip_with_multibyte_path_components() {
let tmp = tempfile::tempdir().unwrap();
let archive = tmp.path().join("tool.zip");
let entries: &[(&str, &[u8], u32)] = &[
("bdms300-front/dist/img/ZC机柜.jpg", b"reported case", 0o644),
("A机柜/file", b"directory", 0o644),
("abé.txt", b"two-byte character", 0o644),
("😀.txt", b"four-byte character", 0o644),
];
zip_file(&archive, entries);
let dest = tmp.path().join("out");
extract(&archive, ArchiveKind::Zip, &dest, "x", &CancellationToken::new()).unwrap();
for (name, data, _) in entries {
assert_eq!(fs::read(dest.join(name)).unwrap(), *data, "{name}");
}
}
#[test]
fn extracts_zip_with_modes_and_nested_dirs() {
let tmp = tempfile::tempdir().unwrap();
+12
Переглянути файл
@@ -0,0 +1,12 @@
import "../src/styles/global.css";
import { createRoot } from "react-dom/client";
import { usePlatform } from "../src/platform/platformInfo";
import { Dialog } from "../src/ui/Dialog";
usePlatform.setState({ os: "macos", overlayTitleBar: true });
document.body.innerHTML = `<div id="root"></div>`;
createRoot(document.querySelector("#root")!).render(
<Dialog open title="Push Commits to origin/main" onClose={() => {}} width={860} maxHeight={720} resizable="both">
<div style={{ height: 2000 }} />
</Dialog>,
);
+10
Переглянути файл
@@ -0,0 +1,10 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Dialog title bar fixture</title>
</head>
<body>
<script type="module" src="./dialogTitleBar.fixture.tsx"></script>
</body>
</html>
+28
Переглянути файл
@@ -0,0 +1,28 @@
import { test, expect, type Page } from "@playwright/test";
async function titleBarHeight(page: Page) {
return page.evaluate(() => parseFloat(getComputedStyle(document.documentElement).getPropertyValue("--h-titlebar")));
}
// Reduced motion skips the opening animation, which scales the dialog while it runs.
test.use({ viewport: { width: 1200, height: 640 }, reducedMotion: "reduce" });
test("a dialog taller than the window stays below the macOS window buttons", async ({ page }) => {
await page.goto("/e2e/dialogTitleBar.html");
const dialog = page.getByRole("dialog");
await expect(dialog).toBeVisible();
const box = (await dialog.boundingBox())!;
expect(box.y).toBeGreaterThanOrEqual(await titleBarHeight(page));
});
test("dragging a dialog up stops below the macOS window buttons", async ({ page }) => {
await page.goto("/e2e/dialogTitleBar.html");
const title = page.getByRole("dialog").locator("[data-dialog-titlebar] span").last();
const start = (await title.boundingBox())!;
await page.mouse.move(start.x + 40, start.y + start.height / 2);
await page.mouse.down();
await page.mouse.move(start.x + 40, 0, { steps: 8 });
await page.mouse.up();
const box = (await page.getByRole("dialog").boundingBox())!;
expect(box.y).toBeGreaterThanOrEqual(await titleBarHeight(page));
});
+10
Переглянути файл
@@ -72,6 +72,16 @@ test("plugin markers render names and package SVG variants and keep the indexed
await expect(markers.locator('[title="Database marker"] svg')).toHaveAttribute("data-icon", "database");
const custom = markers.locator('[title="Package marker"] svg');
await expect(custom).toHaveAttribute("data-icon", /^ext:pluginIcon\/hello\//);
// CodeMirror clips every gutter column to its width (`overflow: hidden`), so an icon wider than
// the column loses its edges: each line-marker icon stays inside the 14px column.
const outside = await markers.evaluate((column) => {
const bounds = column.getBoundingClientRect();
return [...column.querySelectorAll("svg")].filter((svg) => {
const box = svg.getBoundingClientRect();
return box.left < bounds.left - 0.5 || box.right > bounds.right + 0.5;
}).length;
});
expect(outside).toBe(0);
await page.evaluate(async () => {
const path = "/src/workbench/theme.ts";
await (await import(path)).setTheme("dark");
+17 -3
Переглянути файл
@@ -31,7 +31,13 @@
const message = String(reason);
return reason.stack.includes(message) ? reason.stack : `${message}\n${reason.stack}`;
}
return (typeof reason === "string" ? reason : JSON.stringify(reason)) || String(reason);
if (typeof reason === "string") return reason;
// WebKit's fetch / network TypeErrors carry no stack and serialise to "{}".
if (reason instanceof Error || typeof reason?.message === "string") {
const name = typeof reason.name === "string" ? reason.name : "Error";
return `${name}: ${reason.message}`;
}
return JSON.stringify(reason) || String(reason);
} catch {
return "Unknown startup error";
}
@@ -102,7 +108,12 @@
show(event.error || `${event.message}\n${event.filename || ""}:${event.lineno || 0}:${event.colno || 0}`);
}
};
const onRejection = (event) => show(event.reason);
// An unhandled rejection doesn't stop startup by itself (a failed background request
// rejects too); keep the first one for the timeout report instead of failing on it.
let rejection;
const onRejection = (event) => {
if (rejection === undefined) rejection = describe(event.reason);
};
const onBootError = (event) => show(event.detail);
const onReady = () => {
ready = true;
@@ -112,7 +123,10 @@
window.removeEventListener("openidea:boot-error", onBootError);
window.removeEventListener("openidea:boot-ready", onReady);
};
const timer = window.setTimeout(() => show(text.timeout), 30_000);
const timer = window.setTimeout(
() => show(rejection === undefined ? text.timeout : `${text.timeout}\n\nUnhandled rejection: ${rejection}`),
30_000,
);
window.addEventListener("error", onError, true);
window.addEventListener("unhandledrejection", onRejection);
window.addEventListener("openidea:boot-error", onBootError);
+6 -5
Переглянути файл
@@ -30,6 +30,7 @@ import {
javaTypeFromHover,
literalType,
replacesBareStatement,
trailingName,
variableDeclaration,
type DeclContext,
type DeclResult,
@@ -378,17 +379,17 @@ function usesSemicolons(doc: Text, statement: SyntaxNode): boolean {
/** Return / declared type of a Java call or name from the server's hover, if it answers. */
async function javaHoverType(p: Prepared, expr: SyntaxNode, text: string): Promise<string | null> {
const m = /([A-Za-z_$][\w$]*)\s*(\([\s\S]*\))?\s*$/.exec(text);
if (!m || !/method_invocation|identifier|field_access/.test(expr.kind)) return null;
const last = trailingName(text);
if (!last || !/method_invocation|identifier|field_access/.test(expr.kind)) return null;
const { from } = rangeToOffsets(p.doc, expr.range);
const pos = p.doc.lineAt(from + m.index);
const at = { line: pos.number - 1, col: from + m.index - pos.from };
const pos = p.doc.lineAt(from + last.index);
const at = { line: pos.number - 1, col: from + last.index - pos.from };
try {
const hover = await Promise.race([
call(commands.lspHover(nextRequestId(), p.ctx.doc, at)),
new Promise<null>((resolve) => setTimeout(() => resolve(null), 1500)),
]);
return hover ? javaTypeFromHover(hover.contents.value, m[1]!) : null;
return hover ? javaTypeFromHover(hover.contents.value, last.name) : null;
} catch {
return null;
}
+10
Переглянути файл
@@ -5,6 +5,7 @@ import {
isLiteral,
javaConstructedType,
javaTypeFromHover,
trailingName,
literalType,
replacesBareStatement,
variableDeclaration,
@@ -152,6 +153,15 @@ describe("templates", () => {
expect(isLiteral("kotlin", "identifier", "true")).toBe(true);
});
it("finds the name a chained expression ends in, for the hover that types it", () => {
expect(trailingName("demo.getList().get(0)")).toEqual({ name: "get", index: 15 });
expect(trailingName("a.b(c(d)).e")).toEqual({ name: "e", index: 10 });
expect(trailingName("names()")).toEqual({ name: "names", index: 0 });
expect(trailingName("list.get(i) ")).toEqual({ name: "get", index: 5 });
expect(trailingName("(a + b)")).toBeNull();
expect(trailingName("x)")).toBeNull();
});
it("reads a Java type from a jdtls hover", () => {
expect(javaTypeFromHover("```java\nString java.lang.String.trim()\n```", "trim")).toBe("String");
expect(javaTypeFromHover("```java\njava.util.List<java.lang.String> a.B.names()\n```", "names")).toBe(
+21
Переглянути файл
@@ -229,6 +229,27 @@ export function javaConstructedType(text: string): string | null {
return obj[1]!.replace(/\s+/g, "");
}
/**
* The name an expression ends in — the last call's method (`a.b().c(0)` → `c`) or the last
* name (`a.b` → `b`) — with its offset in `text`. Null when it ends in something else.
*/
export function trailingName(text: string): { name: string; index: number } | null {
let end = text.trimEnd().length;
if (text[end - 1] === ")") {
// Back to the `(` that opens the trailing argument list.
let depth = 0;
let i = end - 1;
for (; i >= 0; i--) {
if (text[i] === ")") depth++;
else if (text[i] === "(" && --depth === 0) break;
}
if (i < 0) return null;
end = text.slice(0, i).trimEnd().length;
}
const m = /[A-Za-z_$][\w$]*$/.exec(text.slice(0, end));
return m ? { name: m[0], index: m.index } : null;
}
/**
* Type of a Java expression from a jdtls-style hover (```java\nString java.lang.String.trim()\n```
* or `String name`), for a call / name ending in `name`. Null when unclear.
+4 -1
Переглянути файл
@@ -97,7 +97,10 @@ export function indexedMarkers(path: string): Extension {
display: "flex",
alignItems: "center",
},
".cm-plugin-mapping-button svg": { width: "16px", height: "16px" },
// Only the indexed-marker column sizes its icons to 16px. Line markers reuse the button class
// in their own 14px column (lineMarkerGutter.ts, LineMarkers.module.css), whose `overflow: hidden`
// would clip an icon this size at its edges.
".cm-plugin-mapping-gutter .cm-plugin-mapping-button svg": { width: "16px", height: "16px" },
".cm-plugin-mapping-button:focus-visible": { outline: "1px solid var(--accent)" },
}),
ViewPlugin.fromClass(
+5 -3
Переглянути файл
@@ -339,13 +339,15 @@ export function nodeMenu(
},
]
: []),
// Both destinations, as in the project view's Git menu.
...(toIgnore.length
? [
{
kind: "action" as const,
action: "vcs.ignoreShared",
arg: toIgnore,
label: "Add to .gitignore",
submenu: [
{ kind: "action" as const, action: "vcs.ignoreShared", arg: toIgnore, label: ".gitignore" },
{ kind: "action" as const, action: "vcs.ignoreLocal", arg: toIgnore, label: ".git/info/exclude" },
],
},
]
: []),
+74
Переглянути файл
@@ -0,0 +1,74 @@
import { beforeEach, describe, expect, it, vi } from "vitest";
import type { FileStatus } from "@/bindings";
import type { MenuItem } from "@/ui";
import type { ChangeNode } from "../changes";
vi.mock("@/platform/ipc", async (importOriginal) => {
const real = await importOriginal<typeof import("@/platform/ipc")>();
return { ...real, call: vi.fn() };
});
import { nodeMenu } from "../CommitView";
const file = (rel: string, unstaged: FileStatus["unstaged"] = "modified"): ChangeNode => {
const f: FileStatus = {
path: `/p/${rel}`,
relPath: rel,
staged: null,
unstaged,
renamedFrom: null,
};
return {
key: f.path,
type: "file",
label: rel,
group: "unversioned",
files: [f],
path: f.path,
};
};
const item = (menu: MenuItem[], label: string) =>
menu.find((m) => m.kind !== "separator" && "label" in m && m.label === label);
describe("Add to .gitignore in the changes view", () => {
beforeEach(() => {
vi.clearAllMocks();
});
it("offers both destinations in a submenu, as the project view's Git menu does", () => {
const menu = nodeMenu([file("new.txt", "untracked")], ["/p"]);
expect(item(menu, "Add to .gitignore")).toMatchObject({
submenu: [
{
kind: "action",
action: "vcs.ignoreShared",
arg: ["/p/new.txt"],
label: ".gitignore",
},
{
kind: "action",
action: "vcs.ignoreLocal",
arg: ["/p/new.txt"],
label: ".git/info/exclude",
},
],
});
});
it("targets only the unversioned files of a mixed selection", () => {
const menu = nodeMenu([file("a.ts", "modified"), file("new.txt", "untracked")], ["/p"]);
const parent = item(menu, "Add to .gitignore");
expect(parent).toMatchObject({
submenu: [
{ action: "vcs.ignoreShared", arg: ["/p/new.txt"] },
{ action: "vcs.ignoreLocal", arg: ["/p/new.txt"] },
],
});
});
it("offers nothing when no unversioned file is selected", () => {
const menu = nodeMenu([file("a.ts", "modified")], ["/p"]);
expect(item(menu, "Add to .gitignore")).toBeUndefined();
});
});
+2 -2
Переглянути файл
@@ -59,10 +59,10 @@ describe("ignore action", () => {
await addToIgnore(["/p/pkg/a.txt"], "gitignore");
expect(mocks.open).toHaveBeenCalledWith("/p/pkg/.gitignore", { focus: true });
});
it("opens nothing for the local exclude file", async () => {
it("opens the local exclude file the rule was written to", async () => {
mocks.write.mockResolvedValue(["/p/.git/info/exclude"]);
await addToIgnore(["/p/a.txt"], "localExclude");
expect(mocks.open).not.toHaveBeenCalled();
expect(mocks.open).toHaveBeenCalledWith("/p/.git/info/exclude", { focus: true });
});
it("reports an already ignored selection instead of opening an unchanged file", async () => {
mocks.write.mockResolvedValue([]);
+1 -1
Переглянути файл
@@ -22,5 +22,5 @@ export async function addToIgnore(paths: string[], destination: IgnoreDestinatio
}
// Show the rule where it was written: the nearest .gitignore may be a nested one.
const file = changed?.[0];
if (destination === "gitignore" && file) await editorService().openFile(file, { focus: true });
if (file) await editorService().openFile(file, { focus: true });
}
+28 -9
Переглянути файл
@@ -66,20 +66,39 @@ it.each(resizeObserverMessages)("ignores the loop notification delivered as an E
expect(document.getElementById("boot-error")).toBeNull();
});
it.each(resizeObserverMessages)("keeps rejections with the same message fatal: %s", (message) => {
const reject = (reason: unknown) => {
const event = new Event("unhandledrejection");
Object.defineProperty(event, "reason", { value: message });
Object.defineProperty(event, "reason", { value: reason });
window.dispatchEvent(event);
expect(document.getElementById("splash")).toBeNull();
expect(document.querySelector("textarea")?.value).toContain(message);
};
it("keeps starting after an unhandled rejection", () => {
reject(new TypeError("Load failed"));
expect(document.getElementById("splash")).not.toBeNull();
expect(document.getElementById("boot-error")).toBeNull();
expect(document.documentElement.dataset.boot).toBeUndefined();
window.dispatchEvent(new Event("openidea:boot-ready"));
vi.advanceTimersByTime(30_000);
expect(document.getElementById("boot-error")).toBeNull();
});
it("handles startup rejections and preserves the first failure", () => {
const event = new Event("unhandledrejection");
Object.defineProperty(event, "reason", { value: { message: "startup rejected" } });
window.dispatchEvent(event);
it("reports the first rejection when startup then times out", () => {
const error = new TypeError("Load failed");
// WebKit's network TypeErrors have no stack; JSON.stringify turns them into "{}".
Object.defineProperty(error, "stack", { value: undefined });
reject(error);
reject({ message: "later rejection" });
vi.advanceTimersByTime(30_000);
const details = document.querySelector("textarea")?.value;
expect(details).toContain("Startup did not finish within 30 seconds.");
expect(details).toContain("TypeError: Load failed");
expect(details).not.toContain("later rejection");
});
it("preserves the first failure", () => {
window.dispatchEvent(new ErrorEvent("error", { error: new Error("startup failed") }));
window.dispatchEvent(new ErrorEvent("error", { message: "later failure" }));
expect(document.querySelector("textarea")?.value).toContain("startup rejected");
expect(document.querySelector("textarea")?.value).toContain("startup failed");
expect(document.querySelector("textarea")?.value).not.toContain("later failure");
});
+7
Переглянути файл
@@ -13,6 +13,13 @@
align-items: flex-start;
padding-top: 10vh;
}
/* macOS draws its window buttons over the page; keep dialogs out of that band. */
.belowTitleBar {
padding-top: max(24px, var(--h-titlebar));
}
.belowTitleBar.top {
padding-top: max(10vh, var(--h-titlebar));
}
.dialog {
display: flex;
flex-direction: column;
+4 -2
Переглянути файл
@@ -231,6 +231,7 @@ function DialogInner({
}: DialogProps) {
const ref = useRef<HTMLDivElement>(null);
const platform = useDialogPlatform(platformOverride);
const overlayTitleBar = usePlatform((s) => s.overlayTitleBar);
const given = useGivenTx();
if (typeof title === "string") title = given(title);
// Choosers and untitled dialogs (Recent Files, About) are IDEA popups.
@@ -341,6 +342,7 @@ function DialogInner({
const start = { x: e.clientX - offset.x, y: e.clientY - offset.y };
const rect = el.getBoundingClientRect();
const base = { left: rect.left - offset.x, top: rect.top - offset.y };
const minTop = overlayTitleBar && el.parentElement ? parseFloat(getComputedStyle(el.parentElement).paddingTop) : 0;
const move = (ev: globalThis.PointerEvent) => {
if (!(ev.buttons & 1)) return up();
// Keep the title bar reachable.
@@ -348,7 +350,7 @@ function DialogInner({
Math.max(ev.clientX - start.x, -base.left - rect.width + 80),
window.innerWidth - base.left - 80,
);
const y = Math.min(Math.max(ev.clientY - start.y, -base.top), window.innerHeight - base.top - 28);
const y = Math.min(Math.max(ev.clientY - start.y, minTop - base.top), window.innerHeight - base.top - 28);
setOffset({ x, y });
};
const up = () => {
@@ -401,7 +403,7 @@ function DialogInner({
return createPortal(
<div
className={clsx(styles.backdrop, position === "top" && styles.top)}
className={clsx(styles.backdrop, position === "top" && styles.top, overlayTitleBar && styles.belowTitleBar)}
onPointerDown={(e) => {
if ((dismissOnBackdrop ?? popup) && e.target === e.currentTarget) onClose();
}}
+1 -1
Переглянути файл
@@ -215,7 +215,7 @@ function MainMenuBar({ merged, onExpandedChange }: MainMenuProps & { merged: boo
else void expand();
}}
>
<Icon name="main-menu" size={16} />
<Icon name="main-menu" size={20} />
</button>
);
const titles = (
+11 -4
Переглянути файл
@@ -126,11 +126,16 @@
/* Frameless window (Windows, Linux): caption buttons sit flush with the right and top edges. */
.frameless {
padding-right: 0;
/* The main menu button leads the left stripe, so the bar starts where the
stripe's own padding does and the two share a centre line. */
padding-left: var(--stripe-outer-padding);
}
/* The button heads the tool window stripe below it, so it takes the stripe's
size: both shrink in compact mode. */
.mainMenuButton {
flex: none;
width: 30px;
height: 30px;
width: var(--stripe-icon-button);
height: var(--stripe-icon-button);
margin-right: 4px;
padding: 0;
display: inline-flex;
@@ -147,11 +152,13 @@
outline-offset: -2px;
}
/* Preserve the menu's natural width while allowing its slot to yield to toolbar controls. */
/* Ends where the stripe column below it does, the bar's padding being the
stripe's own. */
.mainMenuSlot {
position: relative;
flex: 0 1 auto;
min-width: 34px;
height: 30px;
min-width: calc(var(--stripe-icon-button) + var(--island-gap));
height: var(--stripe-icon-button);
overflow: hidden;
}
.mainMenuSlot ~ .item,