fix(vcs): maximize diffs and keep file navigation (#907)

Diff tabs, including the preview tab, get Maximize Editor / Restore Size in their toolbar (reusing Hide All Tool Windows). Show Diff from the Commit view or the Git log now carries the whole change list: F7 / Shift+F7 at the last or first difference shows a hint, and pressing again moves to the first or last difference of the neighbouring file, skipping binary, oversized and unreadable files. The layout is restored after a preview is replaced and keyboard focus stays in the diff across files. Compare branches stays single-file.

Fixes #904

Co-authored-by: kkMihai <[email protected]>
Цей коміт міститься в:
kkmihaiтаkkMihai authored and GitHub committed 2026-11-03 23:41:16 +08:00
1 джерело c2fa6f37ab
коміт a3576fca90
14 files changed
+483 -21

No files matched your search

+10
Переглянути файл
@@ -98,6 +98,16 @@ describe("tool window semantics", () => {
expect(isToolWindowVisible("project")).toBe(true);
});
it("restores the maximized side through the shared Hide All toggle", () => {
showToolWindow("terminal");
toggleMaximizeToolWindow("terminal");
const before = useToolWindowLayout.getState();
hideAllToolWindows();
expect(useToolWindowLayout.getState().maximized).toBeNull();
hideAllToolWindows();
expect(useToolWindowLayout.getState()).toMatchObject({ visible: before.visible, maximized: "bottom" });
});
it("resizes the active window by moving its inner edge", () => {
showToolWindow("terminal");
setFocusedToolWindow("terminal");
+4 -2
Переглянути файл
@@ -86,6 +86,7 @@ export interface ToolWindowLayoutState {
focusRequest: { id: string; seq: number } | null;
/** Visible set stashed by "Hide All" so pressing it again restores. */
stashed: SlotRecord | null;
stashedMaximized: ToolWindowAnchor | null;
/** Per-window placement overrides (persisted). */
placements: Readonly<Record<string, ToolWindowPlacement>>;
/** User choice of stripe buttons (opened → added, "Hide" → removed); persisted. */
@@ -105,6 +106,7 @@ const initial = (): ToolWindowLayoutState => ({
mounted: new Set(Object.values(DEFAULT_VISIBLE).filter((v): v is string => !!v)),
focusRequest: null,
stashed: null,
stashedMaximized: null,
placements: {},
stripeButtons: {},
distractionFreeStash: null,
@@ -465,10 +467,10 @@ export function hideAllToolWindows() {
const anyVisible = SLOTS.some((slot) => s.visible[slot]);
if (anyVisible) {
const hadFocus = !!s.focused;
update({ stashed: { ...s.visible }, visible: { ...NONE }, maximized: null });
update({ stashed: { ...s.visible }, stashedMaximized: s.maximized, visible: { ...NONE }, maximized: null });
if (hadFocus) focusEditor();
} else if (s.stashed) {
update({ visible: { ...s.stashed }, stashed: null });
update({ visible: { ...s.stashed }, maximized: s.stashedMaximized, stashed: null, stashedMaximized: null });
}
}