Compare commits

...
Author SHA1 Message Date
l0ng-ai cbc97d24fa Merge remote-tracking branch 'origin/main' into fix/commit-panel-toolbar-layout 2026-11-19 20:57:03 +08:00
l0ng-ai 0cf0e93d92 fix(settings): give settings forms more room (#4515)
Settings starts with 22.5% of its width for navigation instead of a fixed 240px, giving the current form more room at the default window size while leaving space for long labels such as Build, Execution, Deployment. A user-resized divider is still remembered.
2026-11-19 20:56:59 +08:00
l0ng-ai c7ad3459c4 fix(vcs): fit Git Log controls in narrow panes (#4512)
Git Log gives the text filter its own row when the commit pane gets narrow; the other filters stay in More Filters and the action buttons wrap inside the pane, so Refresh, View Options and Go to Hash/Branch/Tag stay usable with the branch and details panes open.
2026-11-19 20:56:31 +08:00
l0ng-ai b397439597 fix(vcs): improve Commit panel layout and message typography 2026-11-19 20:37:04 +08:00
8 changed files with 360 additions and 204 deletions

No files matched your search

+56
View File
@@ -98,3 +98,59 @@ test("commit message history opens above the message without an empty icon colum
expect(Math.abs(menuBox!.x - messageBox!.x)).toBeLessThan(2);
await expect(row.locator("span")).toHaveCount(1);
});
test("the Commit changes toolbar fits a narrow side pane", async ({ workbench: page }) => {
await stubRepository(page);
await page.keyboard.press("Meta+k");
await page.evaluate(async () => {
const path = "/src/workbench/toolwindows/store.ts";
const layout = await import(/* @vite-ignore */ path);
layout.moveToolWindow("commit", "left");
layout.setToolWindowSize("left", 164);
});
const panel = page.getByRole("region", { name: "Commit", exact: true });
const toolbar = panel.getByRole("toolbar", { name: "Changes" });
await expect(toolbar).toBeVisible();
const clipped = await toolbar.evaluate((bar) => {
const bounds = bar.getBoundingClientRect();
return [...bar.querySelectorAll("button")].flatMap((button) => {
const box = button.getBoundingClientRect();
return box.right > bounds.right + 1 || box.bottom > bounds.bottom + 1 ? [button.ariaLabel] : [];
});
});
expect(clipped).toEqual([]);
const push = panel.getByRole("button", { name: "Commit and Push…" });
const overflow = await push.locator("span").evaluate((label) => label.scrollWidth - label.clientWidth);
expect(overflow).toBeLessThanOrEqual(1);
await toolbar.getByRole("button", { name: "Collapse All" }).click();
await expect(panel.getByRole("checkbox", { name: "Include build.gradle.kts in commit" })).toBeHidden();
});
test("the commit message uses the configured editor typography", async ({ workbench: page }) => {
await stubRepository(page);
await page.keyboard.press("Meta+k");
const message = page.getByRole("textbox", { name: "Commit message" });
await expect(message).toBeFocused();
await page.evaluate(async () => {
const path = "/src/platform/project.ts";
const { useProject } = await import(/* @vite-ignore */ path);
const settings = useProject.getState().settings;
useProject.setState({
settings: {
...settings,
editor: {
...settings?.editor,
fontFamily: "Fira Code",
fallbackFont: "Maple Mono NF CN",
fontSize: 17,
lineHeight: 28,
fontWeight: 500,
},
},
});
});
await expect(message).toHaveCSS("font-size", "17px");
await expect(message).toHaveCSS("line-height", "28px");
await expect(message).toHaveCSS("font-weight", "500");
await expect(message).toHaveCSS("font-family", /"Fira Code".*"Maple Mono NF CN"/);
});
+27
View File
@@ -94,3 +94,30 @@ test("a second click on a Git Log toolbar button closes its popup", async ({ wor
await expect(row).toBeHidden();
}
});
test("Git Log keeps filters and actions inside the commit pane at the minimum window width", async ({
workbench: page,
}) => {
await page.setViewportSize({ width: 400, height: 500 });
const toolbar = page.getByRole("toolbar", { name: "Log filters" });
const clippedButtons = () =>
toolbar.evaluate((el) => {
const bar = el.getBoundingClientRect();
return Array.from(el.querySelectorAll("button"))
.filter((button) => {
if (getComputedStyle(button).visibility === "hidden") return false;
const box = button.getBoundingClientRect();
return box.width > 0 && (box.right > bar.right + 1 || box.bottom > bar.bottom + 1);
})
.map((button) => button.getAttribute("aria-label"));
});
await expect.poll(clippedButtons).toEqual([]);
const search = toolbar.getByRole("textbox", { name: "Filter by message" });
await expect(search).toBeVisible();
expect((await search.boundingBox())!.width).toBeGreaterThan(12);
await toolbar.getByRole("button", { name: "View Options" }).click();
await expect(page.getByRole("menuitemcheckbox", { name: "Tag Names" })).toBeVisible();
await page.keyboard.press("Escape");
await toolbar.getByRole("button", { name: "More Filters" }).click();
await expect(page.getByRole("menuitem", { name: "Paths" })).toBeVisible();
});
+1
View File
@@ -72,6 +72,7 @@ test("settings sidebar resizes with mouse and keyboard and remembers its width",
await expect(handle).toBeVisible();
const sidebar = dialog.locator("#navigation");
const initial = (await sidebar.boundingBox())!.width;
expect(initial / (await dialog.getByTestId("settings").boundingBox())!.width).toBeCloseTo(0.225, 2);
const box = (await handle.boundingBox())!;
await page.mouse.move(box.x + box.width / 2, box.y + box.height / 2);
await page.mouse.down();
@@ -321,7 +321,7 @@ export function SettingsLayout() {
return (
<SplitGroup id="settings" orientation="horizontal" storageKey="openidea.settings.layout" className={styles.layout}>
<SplitPanel id="navigation" defaultSize="240px" minSize="160px" maxSize="40%" className={styles.sidebar}>
<SplitPanel id="navigation" defaultSize="22.5%" minSize="160px" maxSize="40%" className={styles.sidebar}>
<SearchField
data-autofocus
className={styles.search}
+25 -10
View File
@@ -26,6 +26,20 @@
gap: var(--space-0-5);
padding: 0 6px;
}
.changesToolbar {
height: auto;
min-height: 32px;
flex-wrap: wrap;
column-gap: var(--space-2);
padding-block: var(--space-0-5);
}
.changesTools {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: var(--space-0-5);
max-width: 100%;
}
.sep {
width: 1px;
height: 16px;
@@ -106,13 +120,12 @@
}
.commitBar {
flex: none;
height: 32px;
min-height: 32px;
display: flex;
flex-wrap: wrap;
align-items: center;
gap: var(--space-1);
padding: 0 6px 0 12px;
white-space: nowrap;
overflow: hidden;
gap: var(--space-0-5) var(--space-1);
padding: var(--space-0-5) 6px var(--space-0-5) 12px;
}
.grow {
flex: 1;
@@ -121,6 +134,7 @@
color: var(--fg-faint);
font-family: var(--font-mono);
font-size: var(--fs-tiny);
white-space: nowrap;
}
.lineLenWarn {
color: var(--warning);
@@ -136,8 +150,6 @@
border-top: 1px solid var(--border);
outline: none;
color: var(--fg-strong);
font-family: var(--font-mono);
font-size: var(--fs-code);
line-height: var(--lh-code);
-webkit-user-select: text;
user-select: text;
@@ -164,7 +176,6 @@
display: flex;
align-items: center;
gap: var(--space-2);
/* A narrow panel moves Commit and Push… to its own row rather than cutting its label. */
flex-wrap: wrap;
padding: 8px 6px 10px 10px;
white-space: nowrap;
@@ -175,10 +186,14 @@
.commitActions > .pushButton {
flex: 0 1 auto;
min-width: 0;
min-height: var(--h-button, 28px);
height: auto;
padding: var(--space-1) var(--space-3);
line-height: 1.3;
}
.pushButton > span {
overflow: hidden;
text-overflow: ellipsis;
white-space: normal;
overflow-wrap: anywhere;
}
.stashList {
flex: 1;
+82 -61
View File
@@ -18,7 +18,9 @@ import {
import { tx, txTemplate } from "@/platform/i18n";
import clsx from "clsx";
import { executeAction } from "@/platform/actions";
import { basename, dirname } from "@/platform/project";
import { fontWeightOf } from "@/platform/editorSettings";
import { resolveMonoFont } from "@/platform/fonts";
import { basename, dirname, useProject } from "@/platform/project";
import { isTestFile, useEffectiveRoots } from "@/platform/projectRoots";
import {
Button,
@@ -763,68 +765,79 @@ export function ChangesTree({ mode }: { mode: "commit" | "local" | "dialog" }) {
return (
<div className={styles.changes}>
<div className={styles.toolbar} role="toolbar" aria-label={tx("Changes")}>
<IconButton icon="refresh" title="Refresh" size="small" onClick={() => void refreshNow()} />
{mode === "local" && <IconButton icon="commit" action="vcs.commit" size="small" />}
<IconButton icon="undo" action="vcs.rollback" size="small" />
{mode === "local" && <IconButton icon="changelist" action="vcs.changelist.new" size="small" />}
{mode !== "dialog" && <IconButton icon="git-pull" action="vcs.update" size="small" />}
<IconButton
ref={viewRef}
icon="eye"
title="View Options"
size="small"
aria-haspopup="menu"
onClick={() =>
viewRef.current &&
showContextMenu(bottomLeft(viewRef.current), [
{ kind: "header", label: "Group By" },
{ label: "Directory", checked: groupByDir, run: () => setGroupByDir(!groupByDir) },
// IDEA offers it once the project has several repositories.
...(repos.length > 1
? [{ label: "Repository", checked: groupByRepo, run: () => setGroupByRepo(!groupByRepo) }]
: []),
...(staging
? []
: [{ label: "Staging State", checked: groupByStaging, run: () => setGroupByStaging(!groupByStaging) }]),
{ kind: "separator" },
{
label: "Show Unversioned Files Separately",
checked: showUnversionedSeparately,
run: () => setShowUnversionedSeparately(!showUnversionedSeparately),
},
...(mode === "local"
? [
{ kind: "separator" } as const,
{ label: "Show Diff Preview", checked: diffPreview, run: () => setDiffPreview(!diffPreview) },
]
: []),
// Not in the Commit dialog, whose files always open as source.
...(mode === "dialog" ? [] : doubleClickMenu(doubleClickOpensDiff)),
])
}
/>
{/* WebStorm's Preview Diff: an embedded diff of the selection beside the changes (#1599). */}
{mode === "commit" && (
<div className={clsx(styles.toolbar, styles.changesToolbar)} role="toolbar" aria-label={tx("Changes")}>
<div className={styles.changesTools}>
<IconButton icon="refresh" title="Refresh" size="small" onClick={() => void refreshNow()} />
{mode === "local" && <IconButton icon="commit" action="vcs.commit" size="small" />}
<IconButton icon="undo" action="vcs.rollback" size="small" />
{mode === "local" && <IconButton icon="changelist" action="vcs.changelist.new" size="small" />}
{mode !== "dialog" && <IconButton icon="git-pull" action="vcs.update" size="small" />}
<IconButton
icon="editor-preview"
title="Preview Diff"
ref={viewRef}
icon="eye"
title="View Options"
size="small"
pressed={commitDiffPreview}
onClick={() => setCommitDiffPreview(!commitDiffPreview)}
aria-haspopup="menu"
onClick={() =>
viewRef.current &&
showContextMenu(bottomLeft(viewRef.current), [
{ kind: "header", label: "Group By" },
{ label: "Directory", checked: groupByDir, run: () => setGroupByDir(!groupByDir) },
// IDEA offers it once the project has several repositories.
...(repos.length > 1
? [{ label: "Repository", checked: groupByRepo, run: () => setGroupByRepo(!groupByRepo) }]
: []),
...(staging
? []
: [
{
label: "Staging State",
checked: groupByStaging,
run: () => setGroupByStaging(!groupByStaging),
},
]),
{ kind: "separator" },
{
label: "Show Unversioned Files Separately",
checked: showUnversionedSeparately,
run: () => setShowUnversionedSeparately(!showUnversionedSeparately),
},
...(mode === "local"
? [
{ kind: "separator" } as const,
{ label: "Show Diff Preview", checked: diffPreview, run: () => setDiffPreview(!diffPreview) },
]
: []),
// Not in the Commit dialog, whose files always open as source.
...(mode === "dialog" ? [] : doubleClickMenu(doubleClickOpensDiff)),
])
}
/>
)}
<span className={styles.sep} />
{mode !== "dialog" && (
<IconButton icon="locate" title="Select Opened File" size="small" onClick={selectOpened} />
)}
<IconButton icon="expand-all" title="Expand All" size="small" onClick={() => setCollapsed(new Set())} />
<IconButton
icon="collapse-all"
title="Collapse All"
size="small"
onClick={() => setCollapsed(new Set([...byKey.values()].filter((n) => n.type !== "file").map((n) => n.key)))}
/>
{/* WebStorm's Preview Diff: an embedded diff of the selection beside the changes (#1599). */}
{mode === "commit" && (
<IconButton
icon="editor-preview"
title="Preview Diff"
size="small"
pressed={commitDiffPreview}
onClick={() => setCommitDiffPreview(!commitDiffPreview)}
/>
)}
</div>
<div className={styles.changesTools}>
{mode !== "dialog" && (
<IconButton icon="locate" title="Select Opened File" size="small" onClick={selectOpened} />
)}
<IconButton icon="expand-all" title="Expand All" size="small" onClick={() => setCollapsed(new Set())} />
<IconButton
icon="collapse-all"
title="Collapse All"
size="small"
onClick={() =>
setCollapsed(new Set([...byKey.values()].filter((n) => n.type !== "file").map((n) => n.key)))
}
/>
</div>
</div>
{mode !== "dialog" && <OperationBanner />}
<div
@@ -1133,6 +1146,8 @@ export function CommitMessageField({
}
const cfg = useWorkflowSettings((s) => s.vcs.commit);
const editor = useProject((s) => s.settings?.editor);
const { family, size } = resolveMonoFont(undefined, editor);
const first = message.split("\n")[0] ?? "";
const tooLong = cfg.limitSubject && first.length > cfg.subjectLimit;
const problems = messageProblems(message, cfg).filter((p) => !p.startsWith("Subject line"));
@@ -1182,7 +1197,13 @@ export function CommitMessageField({
data-autofocus={autoFocus ? "" : undefined}
className={clsx(styles.message, !showMargin && styles.noMargin, emptyError && styles.messageError)}
aria-invalid={emptyError || undefined}
style={{ ["--guide" as string]: `${margin}ch` }}
style={{
["--guide" as string]: `${margin}ch`,
fontFamily: family,
fontSize: size,
fontWeight: fontWeightOf(editor?.fontWeight, 400),
lineHeight: editor?.lineHeight ? `${editor.lineHeight}px` : undefined,
}}
value={message}
placeholder={tx("Commit Message")}
aria-label={tx("Commit message")}
+37 -4
View File
@@ -14,6 +14,7 @@
min-height: 0;
}
.log {
container: git-log / inline-size;
height: 100%;
min-height: 0;
display: flex;
@@ -75,14 +76,32 @@
/* filters */
.filters {
gap: var(--space-1);
padding: 0 8px 0 6px;
height: auto;
min-height: 32px;
flex-wrap: wrap;
justify-content: flex-end;
gap: var(--space-0-5) var(--space-1);
padding: var(--space-0-5) 8px var(--space-0-5) 6px;
min-width: 0;
overflow: hidden;
}
.filterControls,
.filterActions {
display: flex;
align-items: center;
gap: var(--space-1);
}
.filterControls {
flex: 1 1 260px;
min-width: 0;
}
.filterActions {
flex-wrap: wrap;
justify-content: flex-end;
max-width: 100%;
}
.textFilter {
flex: 0 1 260px;
min-width: 100px;
min-width: min(100px, 60%);
}
.filterGroup {
position: relative;
@@ -96,6 +115,20 @@
.filterHidden {
visibility: hidden;
}
@container git-log (max-width: 320px) {
.filterControls,
.filterActions {
display: contents;
}
.textFilter {
flex: 1 0 100%;
}
/* Keep the filters measurable for the overflow menu. */
.filterGroup {
position: absolute;
width: 0;
}
}
.filterButton {
flex: none;
height: 24px;
+131 -128
View File
@@ -293,55 +293,57 @@ export function FilterBar() {
return (
<div className={styles.filters} role="toolbar" aria-label={tx("Log filters")}>
{!showBranches && (
<IconButton icon="chevron-right" title="Show Branches" size="small" action="vcs.log.showBranches" />
)}
<SearchField
className={styles.textFilter}
value={text}
onChange={setText}
placeholder="Text or hash"
aria-label="Filter by message"
toggles={[
{
id: "regex",
icon: "regex",
title: "Regex",
pressed: filters.regex,
onToggle: (regex) => setLogFilters({ regex }),
},
{
id: "case",
icon: "case",
title: "Match Case",
pressed: filters.matchCase,
onToggle: (matchCase) => setLogFilters({ matchCase }),
},
]}
/>
<span ref={groupRef} className={styles.filterGroup}>
{logFilters.map((f, i) => (
<FilterButton key={f.label} {...f} hidden={i >= hiddenFrom} />
))}
</span>
{hiddenFrom < logFilters.length && (
<IconButton
icon="chevron-right"
title="More Filters"
size="small"
aria-haspopup="menu"
onClick={(e) => {
const anchor = e.currentTarget;
menuBelow(
anchor,
logFilters.slice(hiddenFrom).map((f) => ({
label: f.value ? `${tx(f.label)}: ${f.value}` : f.label,
run: () => f.onOpen(anchor),
})),
);
}}
<div className={styles.filterControls}>
{!showBranches && (
<IconButton icon="chevron-right" title="Show Branches" size="small" action="vcs.log.showBranches" />
)}
<SearchField
className={styles.textFilter}
value={text}
onChange={setText}
placeholder="Text or hash"
aria-label="Filter by message"
toggles={[
{
id: "regex",
icon: "regex",
title: "Regex",
pressed: filters.regex,
onToggle: (regex) => setLogFilters({ regex }),
},
{
id: "case",
icon: "case",
title: "Match Case",
pressed: filters.matchCase,
onToggle: (matchCase) => setLogFilters({ matchCase }),
},
]}
/>
)}
<span ref={groupRef} className={styles.filterGroup}>
{logFilters.map((f, i) => (
<FilterButton key={f.label} {...f} hidden={i >= hiddenFrom} />
))}
</span>
{hiddenFrom < logFilters.length && (
<IconButton
icon="chevron-right"
title="More Filters"
size="small"
aria-haspopup="menu"
onClick={(e) => {
const anchor = e.currentTarget;
menuBelow(
anchor,
logFilters.slice(hiddenFrom).map((f) => ({
label: f.value ? `${tx(f.label)}: ${f.value}` : f.label,
run: () => f.onOpen(anchor),
})),
);
}}
/>
)}
</div>
{dropdown}
{branchAnchor && (
<BranchFilterPopup
@@ -356,88 +358,89 @@ export function FilterBar() {
onSelectMany={() => void selectBranches()}
/>
)}
<span className={styles.grow} />
<IconButton
icon="bookmark"
title="Bookmarked Commits"
size="small"
disabled={!Object.keys(bookmarks).length}
onClick={(e) =>
menuBelow(
e,
Object.entries(bookmarks).map(([key, summary]) => ({
label: summary,
run: () => {
const split = key.lastIndexOf("\0");
void goToRef(key.slice(split + 1), split >= 0 ? key.slice(0, split) : undefined);
<div className={styles.filterActions}>
<IconButton
icon="bookmark"
title="Bookmarked Commits"
size="small"
disabled={!Object.keys(bookmarks).length}
onClick={(e) =>
menuBelow(
e,
Object.entries(bookmarks).map(([key, summary]) => ({
label: summary,
run: () => {
const split = key.lastIndexOf("\0");
void goToRef(key.slice(split + 1), split >= 0 ? key.slice(0, split) : undefined);
},
})),
)
}
/>
<IconButton
icon="plus"
title="Open Another Log Tab"
size="small"
onClick={(e) =>
menuBelow(e, [
{
label: "In Tool Window",
run: () => {
openLogTab("log", `Log ${useGitLog.getState().logTabs.length + 1}`);
},
},
})),
)
}
/>
<IconButton
icon="plus"
title="Open Another Log Tab"
size="small"
onClick={(e) =>
menuBelow(e, [
{
label: "In Tool Window",
run: () => {
openLogTab("log", `Log ${useGitLog.getState().logTabs.length + 1}`);
{
label: "In Editor",
run: () => {
openLogTab("log", `Log ${useGitLog.getState().logTabs.length + 1}`, "editor");
},
},
},
{
label: "In Editor",
run: () => {
openLogTab("log", `Log ${useGitLog.getState().logTabs.length + 1}`, "editor");
},
},
{ label: "External Repository…", run: openExternalLog },
])
}
/>
<IconButton
icon="clock"
title="Recent Filters"
size="small"
onClick={(e) =>
menuBelow(
e,
recentLogFilters().map((filters) => ({
label:
[
filters.range,
filters.branches.join(", "),
filters.authors.join(", "),
filters.text,
filters.path,
filters.paths?.join(", "),
filters.date?.label,
]
.filter(Boolean)
.join(" · ") || tx("All commits"),
run: () => setLogFilters(filters),
})),
)
}
/>
<IconButton icon="refresh" title="Refresh" size="small" onClick={() => void reloadLog({ preserve: true })} />
<IconButton
icon="sort"
title="Graph Options"
size="small"
aria-haspopup="menu"
onClick={(e) => menuBelow(e, graphOptionsMenu(useLogOptions.getState()))}
/>
<IconButton
icon="eye"
title="View Options"
size="small"
aria-haspopup="menu"
onClick={(e) => menuBelow(e, viewOptionsMenu(useLogOptions.getState()))}
/>
<IconButton icon="search" title="Go to Hash/Branch/Tag" size="small" action="vcs.log.goToRef" />
{ label: "External Repository…", run: openExternalLog },
])
}
/>
<IconButton
icon="clock"
title="Recent Filters"
size="small"
onClick={(e) =>
menuBelow(
e,
recentLogFilters().map((filters) => ({
label:
[
filters.range,
filters.branches.join(", "),
filters.authors.join(", "),
filters.text,
filters.path,
filters.paths?.join(", "),
filters.date?.label,
]
.filter(Boolean)
.join(" · ") || tx("All commits"),
run: () => setLogFilters(filters),
})),
)
}
/>
<IconButton icon="refresh" title="Refresh" size="small" onClick={() => void reloadLog({ preserve: true })} />
<IconButton
icon="sort"
title="Graph Options"
size="small"
aria-haspopup="menu"
onClick={(e) => menuBelow(e, graphOptionsMenu(useLogOptions.getState()))}
/>
<IconButton
icon="eye"
title="View Options"
size="small"
aria-haspopup="menu"
onClick={(e) => menuBelow(e, viewOptionsMenu(useLogOptions.getState()))}
/>
<IconButton icon="search" title="Go to Hash/Branch/Tag" size="small" action="vcs.log.goToRef" />
</div>
</div>
);
}