From 6abfefde1c402de8ecea567b4d8ebd20746b52eb Mon Sep 17 00:00:00 2001 From: wwei-gtihub <418047394@qq.com> Date: Wed, 4 Nov 2026 14:42:47 +0800 Subject: [PATCH 1/6] =?UTF-8?q?fix(v0.25.1):=20=E5=8F=B3=E4=BE=A7=E6=A0=8F?= =?UTF-8?q?=E7=82=B9=E5=8F=98=E6=9B=B4=E6=96=87=E4=BB=B6=E7=AB=8B=E5=8D=B3?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E5=B7=AE=E5=BC=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 用户报告:在右侧栏点变更文件看不到任何差异。 根因:窄栏(compact)chrome 的「变更」分段只渲染变更列表——`view === 'changes'` 那一支没有 diff 面板。patch 已经取回、状态也更新了,屏幕上却没有地方显示。 - 窄栏在 `patch !== '' || patchLoading === true` 时把列表换成填满主体的 diff 面板(`.dig-diff-pane-fill`,不受 55% 分栏高度限制);头部保留文件路径与关闭按钮,关闭即回列表,分段条仍可切「历史」。 - 变更列表**纯单击**改为「选中 + 打开 diff」(用户选择)。Ctrl/Cmd/Shift 点击保持只做多选,批量暂存/丢弃不受影响;ignored 组的行不触发。 - `showDiff` 的内嵌分支补写 `selectedPath`,工作区 diff 头部不再显示空路径。 - 列表行原先的「单击=选中、双击=打开」注释与实现同步更新(双击仍然有效,是幂等重开)。 验证:npm test 125/125(新增冒烟测试锁定单击开 diff、窄栏填充式 diff 面板、分栏仍消费存储尺寸、头部写路径);node --check 通过。 --- CHANGELOG.md | 9 +++++++++ dsh.plugin.json | 2 +- package.json | 2 +- src/client.js | 22 +++++++++++++++++----- tests/smoke.mjs | 18 +++++++++++++++++- 5 files changed, 45 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 71ef580..0511b32 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,15 @@ > 倒序排列,新版本条目在最上面。条目格式:`## vX.Y.Z — YYYY-MM-DD` + 类型(feat / fix / docs / chore)+ 要点 + 相关链接。 > 纪律见 AGENTS.md「变更记录纪律」:发版前先更新本文件并随版本提交。 +## v0.25.1 — 2026-11-04 + +**类型**:fix + feat(右侧栏点变更文件看不到差异) + +- **fix 右栏「变更」页终于有 diff 面板**:用户报告「点击变更文件没有立即展示差异」。根因是窄栏(compact)chrome 的「变更」分段只渲染变更列表——`view === 'changes'` 那一支根本没有 diff 面板,于是 patch 已经取回、状态已经更新,屏幕上却没有任何东西。现在窄栏在 `patch !== '' || patchLoading === true` 时把列表换成填满主体的 diff 面板(`.dig-diff-pane-fill`,不受 55% 分栏高度限制),头部保留文件路径与关闭按钮,关掉即回到列表;分段条仍可切到「历史」。 +- **feat 单击变更文件即打开差异**:按用户要求,变更列表的**纯单击**从「只选中」改为「选中 + 打开该文件 diff」——窄栏里列表会把整块内容换掉,只高亮一行看起来像「点了没反应」。Ctrl/Cmd/Shift 点击维持原状(只做多选,批量暂存/丢弃不受影响),忽略组(`ignored`)的行不触发 diff。 +- **fix 内嵌 diff 头部显示文件名**:`showDiff` 的内嵌分支此前没写 `selectedPath`,工作区 diff 的头部路径一直是空的;现在打开时一并写入,关闭时按原逻辑清空。 +- **验证**:`npm test` 125/125(新增一条冒烟测试锁定「单击开 diff / 窄栏渲染填充式 diff 面板 / 分栏仍消费存储尺寸 / 头部写路径」);`node --check src/client.js`。窄栏渲染由 SSR 自检覆盖不到(需要真数据),本轮未起隔离实例截图。 + ## v0.25.0 — 2026-11-04 **类型**:feat(图标悬停显示操作名) diff --git a/dsh.plugin.json b/dsh.plugin.json index 1252c12..ad49e27 100644 --- a/dsh.plugin.json +++ b/dsh.plugin.json @@ -1,6 +1,6 @@ { "id": "dsh-external/dsh-ide-git", - "version": "0.25.0", + "version": "0.25.1", "main": "./src/index.js", "description": "IDE 级 Git 操作面板:分支树 + 提交图谱 + 变更/暂存/提交 + 提交详情。装了 dsh-better-sidebar 时挂成它的原生 tab(右侧栏 + 底部工作台);没装时直接挂 DSH 原生右侧栏,单独安装即可用。JetBrains 风格 Git 工具窗口 for DeepSeek Harness.", "engines": { diff --git a/package.json b/package.json index 8536823..c04a378 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dsh-ide-git", - "version": "0.25.0", + "version": "0.25.1", "description": "DSH plugin: an IDE-grade Git tool window as a native dsh-better-sidebar tab — branch tree, commit graph, changes, commit details, JetBrains-style actions, in the right sidebar and the bottom panel. | DSH 插件:IDE 级 Git 工具窗口,以 dsh-better-sidebar 原生 Tab 挂载——分支树 / 提交图谱 / 变更与提交详情 / JetBrains 风格操作,右侧栏与底部面板双布局自适应。", "type": "module", "repository": { diff --git a/src/client.js b/src/client.js index 4db118f..bcffabb 100644 --- a/src/client.js +++ b/src/client.js @@ -12027,10 +12027,12 @@ window.__ModuleLoader__.load({ return } anchorRef.current = key - /* Plain click only SELECTS (single-replace, the branch tree's model): - the diff moved to DOUBLE-click — a stray click mid-multi-select must - not yank the pane away (v0.18.3). */ + /* Plain click SELECTS and shows the diff (v0.25.1, user request): in the + narrow right column the list replaces the pane, so a click that only + highlighted the row looked like "nothing happened". Modifier clicks + above stay pure multi-select; ignored rows have no diff to show. */ setSelection((previous) => previous.size === 1 && previous.has(key) === true ? previous : new Set([key])) + if (group !== 'ignored' && props.onDiff !== undefined) props.onDiff(item, group) }, [setSelection, anchorRef, props.onDiff]) /* Rubber-band selection now comes from the shared useRubberBand hook (see its comment): the fixed row heights + the prefix-sum offsets @@ -13939,6 +13941,9 @@ window.__ModuleLoader__.load({ file menu, working-diff shortcut): external first, inline fallback. */ const showDiff = useCallback((seed) => { if (previewDiff(seed) === true) return + /* The pane header names the file; its close button clears the selection + again, so the inline path owns selectedPath here too. */ + setSelectedPath(seed.path === undefined ? null : seed.path) if (seed.hash !== undefined && seed.hash !== null) { setDiffContext({ kind: 'commit', hash: seed.hash, subject: seed.subject || '' }) void openDiff({ hash: seed.hash, path: seed.path }) @@ -14846,7 +14851,10 @@ window.__ModuleLoader__.load({ request: request, }) - const diffPane = patch === '' && patchLoading === false ? null : E('div', { className: 'dig-diff-pane', 'data-pane': 'diff', style: paneStyle('diff'), onContextMenu: onDiffPaneContextMenu }, + /* The compact chrome renders the diff INSTEAD of the changes list (the + narrow right column has no neighbour to show it beside), so it needs a + filling variant; every other chrome keeps the 55%-tall split pane. */ + const diffPaneOf = (fill) => patch === '' && patchLoading === false ? null : E('div', { className: 'dig-diff-pane' + (fill === true ? ' dig-diff-pane-fill' : ''), 'data-pane': 'diff', style: fill === true ? null : paneStyle('diff'), onContextMenu: onDiffPaneContextMenu }, E('div', { className: 'dig-diff-head' }, E('span', { className: 'dig-mono dig-diff-path' }, selectedPath === null ? '' : selectedPath), E('button', { @@ -14856,6 +14864,7 @@ window.__ModuleLoader__.load({ onClick: () => { setPatch(''); setSelectedPath(null); setDiffContext(null) }, }, E(Icon, { name: 'close', size: 12 }))), E(DiffBody, { patch: patch, loading: patchLoading, t: t })) + const diffPane = diffPaneOf(false) /* ---------- rail (IDE-style left action strip) ---------- */ @@ -15427,7 +15436,9 @@ window.__ModuleLoader__.load({ }, E(Icon, { name: treeOpen ? 'eye' : 'eyeOff' }))), treeOpen ? E('div', { className: 'dig-compact-tree', 'data-pane': 'tree', style: paneStyle('tree') }, E(BranchTree, { t: t, branches: branches, favorites: favorites, onCheckout: checkout, onBrowse: browseBranch, onBranchMenu: branchMenu, onDeleteEntries: deleteBranchEntries, onCopyValues: copyValues, onPicksChange: onBranchPicks, clearSignal: pickEpochs.tree })) : null, treeOpen ? gutter('tree', 'prev') : null, - view === 'changes' ? changesPane : E('div', { className: 'dig-pane dig-pane-main' }, historyPane, diffGutter, diffPane)) + view === 'changes' + ? (patch === '' && patchLoading === false ? changesPane : E('div', { className: 'dig-pane dig-pane-main' }, diffPaneOf(true))) + : E('div', { className: 'dig-pane dig-pane-main' }, historyPane, diffGutter, diffPane)) } else if (columns) { body = E('div', { className: 'dig-body dig-body-columns', ref: bodyRef }, treeOpen ? E('div', { className: 'dig-pane dig-pane-tree', 'data-pane': 'tree', style: paneStyle('tree') }, E(BranchTree, { t: t, branches: branches, favorites: favorites, onCheckout: checkout, onBrowse: browseBranch, onBranchMenu: branchMenu, onDeleteEntries: deleteBranchEntries, onCopyValues: copyValues, onPicksChange: onBranchPicks, clearSignal: pickEpochs.tree })) : null, @@ -16176,6 +16187,7 @@ window.__ModuleLoader__.load({ '.dig-detail-files{display:flex;flex-direction:column}', '.dig-mono{font-family:ui-monospace,SFMono-Regular,Menlo,monospace}', '.dig-diff-pane{flex:none;max-height:55%;display:flex;flex-direction:column;min-height:0;border-top:1px solid var(--dsw-alias-border-l2)}', + '.dig-diff-pane-fill{flex:1;max-height:none;border-top:none}', '.dig-diff-head{display:flex;align-items:center;gap:8px;padding:3px 8px;color:var(--dsw-alias-label-tertiary);flex:none;min-width:0}', '.dig-diff-path{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0}', '.dig-diff{flex:1;overflow:auto;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:calc(12px + var(--dsh-code-font-delta, 0px));line-height:1.5;font-weight:500;min-height:0}', diff --git a/tests/smoke.mjs b/tests/smoke.mjs index da3e158..b45b17a 100644 --- a/tests/smoke.mjs +++ b/tests/smoke.mjs @@ -1189,7 +1189,7 @@ test('a divider only exists when it can move something', () => { // diff pane, so its diff window (fixed max-height:55%) could not be resized // at all — user report. Every chrome now hands out a real diff window; the // diff keeps measuring HEIGHT even where the chrome runs sideways. - assert.match(client, /className: 'dig-diff-pane', 'data-pane': 'diff', style: paneStyle\('diff'\)/, + assert.match(client, /const diffPaneOf = \(fill\) => [^\n]*style: fill === true \? null : paneStyle\('diff'\)/, 'the diff pane must actually consume the stored size') assert.match(client, /if \(limit === undefined \|\| limit\.max <= limit\.min\) return null/, 'no pane in this chrome, or no travel in either direction, means no divider element') @@ -2087,3 +2087,19 @@ test('upstream management: bind, drop and create-tracking from menus (v0.20.0, i assert.equal((client.match(new RegExp("'" + key.replace(/\./g, '\\.') + "':", 'g')) || []).length, 21, '21 gates carry ' + key) } }) + +test('clicking a changed file shows its diff in every chrome (v0.25.1)', () => { + // User report (right column): clicking a changed file did nothing visible. + // The row handler only selected, and the compact chrome had no diff pane at + // all, so the patch that was already fetched had nowhere to render. + assert.match(client, /if \(group !== 'ignored' && props\.onDiff !== undefined\) props\.onDiff\(item, group\)/, + 'a plain click on a changed file opens its diff') + assert.match(client, /'dig-diff-pane' \+ \(fill === true \? ' dig-diff-pane-fill' : ''\)/, + 'the compact chrome can render a filling diff pane') + assert.match(client, /view === 'changes'\n\s+\? \(patch === '' && patchLoading === false \? changesPane/, + 'the compact changes tab swaps to the diff when a patch is loaded') + assert.match(client, /const diffPaneOf = \(fill\) => [^\n]*style: fill === true \? null : paneStyle\('diff'\)/, + 'the split pane still consumes the stored size') + assert.match(client, /setSelectedPath\(seed\.path === undefined \? null : seed\.path\)/, + 'the inline diff header names the file it shows') +}) From 46cb86a7b928c715e4befde0f0fd946618da77bc Mon Sep 17 00:00:00 2001 From: wwei-gtihub <418047394@qq.com> Date: Wed, 4 Nov 2026 14:46:38 +0800 Subject: [PATCH 2/6] =?UTF-8?q?fix(v0.25.2):=20=E7=AA=84=E6=A0=8F=E5=8E=86?= =?UTF-8?q?=E5=8F=B2=E7=9A=84=E5=B7=A6=E7=BC=98=E4=B8=8E=E4=B8=8A=E6=96=B9?= =?UTF-8?q?=E8=BE=93=E5=85=A5=E6=A1=86=E5=AF=B9=E9=BD=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 提交行 `.dig-commit` 的左内边距一直是 0,时间列和图谱 lane 顶着面板左缘;而上方筛选条(文本/分支/作者/日期)与窄栏分段条都是 `4px 6px` 内边距——输入框左缘在 6px、提交行在 0,看起来就是「时间没和输入框对齐」。 现在提交行的左内边距取同一个 6px(`padding:1px 8px 1px 6px`),时间列、lane 与输入框左缘齐平,compact / stack / columns 三种 chrome 一起生效。 验证:npm test 125/125、node --check 通过。纯样式改动,headless 里量不到真实像素,真机效果待重启后确认。 --- CHANGELOG.md | 7 +++++++ dsh.plugin.json | 2 +- package.json | 2 +- src/client.js | 5 ++++- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0511b32..50da07a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,13 @@ > 倒序排列,新版本条目在最上面。条目格式:`## vX.Y.Z — YYYY-MM-DD` + 类型(feat / fix / docs / chore)+ 要点 + 相关链接。 > 纪律见 AGENTS.md「变更记录纪律」:发版前先更新本文件并随版本提交。 +## v0.25.2 — 2026-11-04 + +**类型**:fix(窄栏历史的时间列与上方输入框没对齐) + +- **fix 提交行左侧补内边距**:`.dig-commit` 的左内边距一直是 0,时间列与图谱 lane 顶着面板左缘;而上方的筛选条(文本/分支/作者/日期 `.dig-filters`)和窄栏的分段条都是 `4px 6px` 内边距——输入框左缘在 6px,提交行在 0,肉眼就是「时间没和输入框对齐」。现在提交行左内边距取同一个 6px(`padding:1px 8px 1px 6px`),时间列、图谱 lane 与输入框左缘齐平,三种 chrome(compact / stack / columns)一起生效。 +- **验证**:`npm test` 125/125;`node --check src/client.js`。纯样式改动,headless 无法测量真实像素,真机效果以重启后肉眼为准。 + ## v0.25.1 — 2026-11-04 **类型**:fix + feat(右侧栏点变更文件看不到差异) diff --git a/dsh.plugin.json b/dsh.plugin.json index ad49e27..73d1fd1 100644 --- a/dsh.plugin.json +++ b/dsh.plugin.json @@ -1,6 +1,6 @@ { "id": "dsh-external/dsh-ide-git", - "version": "0.25.1", + "version": "0.25.2", "main": "./src/index.js", "description": "IDE 级 Git 操作面板:分支树 + 提交图谱 + 变更/暂存/提交 + 提交详情。装了 dsh-better-sidebar 时挂成它的原生 tab(右侧栏 + 底部工作台);没装时直接挂 DSH 原生右侧栏,单独安装即可用。JetBrains 风格 Git 工具窗口 for DeepSeek Harness.", "engines": { diff --git a/package.json b/package.json index c04a378..7729962 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dsh-ide-git", - "version": "0.25.1", + "version": "0.25.2", "description": "DSH plugin: an IDE-grade Git tool window as a native dsh-better-sidebar tab — branch tree, commit graph, changes, commit details, JetBrains-style actions, in the right sidebar and the bottom panel. | DSH 插件:IDE 级 Git 工具窗口,以 dsh-better-sidebar 原生 Tab 挂载——分支树 / 提交图谱 / 变更与提交详情 / JetBrains 风格操作,右侧栏与底部面板双布局自适应。", "type": "module", "repository": { diff --git a/src/client.js b/src/client.js index bcffabb..aa4e171 100644 --- a/src/client.js +++ b/src/client.js @@ -16076,7 +16076,10 @@ window.__ModuleLoader__.load({ filter bar, and painting from the wrong rect was the v0.19.2 drift. */ '.dig-history{display:flex;flex-direction:column;min-height:0;flex:1;position:relative}', '.dig-history-scroll{flex:1;overflow:auto}', - '.dig-commit{display:flex;align-items:center;gap:6px;padding:1px 8px 1px 0;cursor:pointer;height:26px;overflow:hidden}', + // The row's left edge follows the bars above it (filter row / compact + // switch: 4px 6px padding), so the time column and the graph start on the + // same inset as the input box instead of flush against the pane edge. + '.dig-commit{display:flex;align-items:center;gap:6px;padding:1px 8px 1px 6px;cursor:pointer;height:26px;overflow:hidden}', '.dig-commit:hover{background:var(--dsw-alias-interactive-bg-hover)}', /* Same theme-aware gray mix as .dig-row-selected (see it). */ '.dig-commit-selected{background:color-mix(in srgb,var(--dsw-alias-interactive-bg-active,var(--dsw-alias-interactive-bg-hover)) 58%,var(--dsw-static-neutral-bluish-75,var(--dsw-alias-bg-layer-3)) 42%);color:var(--dsw-alias-label-primary);box-shadow:inset 2px 0 0 var(--dsw-alias-brand-primary)}', From b354b31e7870c78eb45f6c8432e88bb16e265906 Mon Sep 17 00:00:00 2001 From: wwei-gtihub <418047394@qq.com> Date: Wed, 4 Nov 2026 14:59:41 +0800 Subject: [PATCH 3/6] =?UTF-8?q?feat(v0.26.0):=20=E7=AA=84=E6=A0=8F?= =?UTF-8?q?=E6=94=B9=E6=88=90=E3=80=8C=E5=8F=98=E6=9B=B4=E5=9C=A8=E4=B8=8A?= =?UTF-8?q?=E3=80=81=E5=8E=86=E5=8F=B2/=E5=B7=AE=E5=BC=82=E9=A1=B5?= =?UTF-8?q?=E7=AD=BE=E5=9C=A8=E4=B8=8B=E3=80=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit v0.25.1 让窄栏点变更文件立即出 diff,但那一版是整块替换——diff 一出来变更列表就没了,历史也被顶走。 布局改成上下两段: - 上段是变更列表(`.dig-pane-changes-stack`,分隔条可拖、双击复位,比例与其它面板同存 `dsh-ide-git.panes.v1`) - 下段是 `.dig-compact-tabs`:「历史」/「差异」两个页签,左侧保留「变更 {n}」计数(该 chrome 里变更头是隐藏的) - 没有 diff 时「差异」置灰;点变更文件自动切到「差异」;关掉 diff 自动落回「历史」 面板几何:`PANE_CHROME_KEYS.compact` 由 `['tree','diff']` 改成 `['tree','changes']`,新增 `compact:changes` 限制与默认值、删掉 `compact:diff`,body 分隔条 1 → 2。旧存储里的 compact diff 比例会被 normalizePanes 丢弃。 同时更新:客户端顶部 chrome 说明注释、dock-probe 的树开关选择器、两份 README 的布局表与功能表。 验证:npm test 125/125、node --check 通过。 --- CHANGELOG.md | 10 +++++ README.md | 4 +- README_EN.md | 4 +- dsh.plugin.json | 2 +- package.json | 2 +- scripts/dock-probe.mjs | 6 +-- src/client.js | 100 ++++++++++++++++++++++++++++------------- tests/smoke.mjs | 12 +++-- 8 files changed, 100 insertions(+), 40 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 50da07a..7af4704 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,16 @@ > 倒序排列,新版本条目在最上面。条目格式:`## vX.Y.Z — YYYY-MM-DD` + 类型(feat / fix / docs / chore)+ 要点 + 相关链接。 > 纪律见 AGENTS.md「变更记录纪律」:发版前先更新本文件并随版本提交。 +## v0.26.0 — 2026-11-04 + +**类型**:feat(窄栏改成「变更在上、历史/差异页签在下」) + +- **背景**:v0.25.1 让窄栏点变更文件立即出 diff,但那一版是「整块替换」——diff 一出来,变更列表就没了,历史也被顶走,想回去还得再点一次分段开关。 +- **布局**:紧凑 chrome(宽 < 400px)改成上下两段。上段是变更列表(`.dig-pane-changes-stack`,分隔条可拖、双击复位,比例与其它面板同存 `dsh-ide-git.panes.v1`);下段是 `.dig-compact-tabs` 页签条 + 内容:「历史」/「差异」两个页签,页签条左侧保留原来的「变更 {n}」计数(变更头在这个 chrome 里是隐藏的)。没有 diff 时「差异」页签置灰(`title` 给出原因);点变更文件自动切到「差异」;关掉 diff(头部 ×)自动落回「历史」。 +- **面板几何**:`PANE_CHROME_KEYS.compact` 由 `['tree','diff']` 改成 `['tree','changes']`,`PANE_LIMITS` / `PANE_DEFAULTS` 新增 `compact:changes` 并删掉 `compact:diff`,body 分隔条计数 1 → 2。旧存储里的 `compact:*` diff 比例会被 `normalizePanes()` 丢弃,不影响其它 chrome 的尺寸。 +- **同时更新**:客户端顶部那段「chrome 说明」注释、`scripts/dock-probe.mjs` 里定位树开关的选择器(`.dig-compact-bar` → `.dig-compact-tabs`)、两份 README 的布局表与功能表。 +- **验证**:`npm test` 125/125(改了 2 条旧断言,新增 4 条:差异/历史页签存在、变更列表置顶、pane key 集合);`node --check src/client.js`。纯布局改动,headless 量不到真机像素,需要重启 App 后目测。 + ## v0.25.2 — 2026-11-04 **类型**:fix(窄栏历史的时间列与上方输入框没对齐) diff --git a/README.md b/README.md index ce30d7a..2d44ee4 100644 --- a/README.md +++ b/README.md @@ -87,14 +87,16 @@ DSH 自带的 Git 面板覆盖「暂存 / 提交 / 还原 / 看历史」;`dsh-id |---|---|---| | 右侧栏(原生的,或底座桥接过来的) | 窄而高 | `stack`:变更区在提交历史之上,分支树可收起,详情/差异占满主区 | | 底部工作台(底座自有) | 宽而扁 | `columns`:分支树 · 提交图谱 · 变更与提交框,三栏并排——就是 JetBrains Git 工具窗口的样子 | +| 侧栏被拖得很窄(< 400px) | 窄 | `compact`:变更列表在上,下方是「历史 / 差异」双页签,分支树可收起 | -插件不猜自己在哪儿,而是用 `ResizeObserver` 量自己的容器:宽 ≥ 600px 且宽 ≥ 高 × 1.15 走三栏,否则走纵向堆叠(宽度说了算,高度没有否决权)。自由浮窗、移动端抽屉同样自适应。 +插件不猜自己在哪儿,而是用 `ResizeObserver` 量自己的容器:宽 ≥ 600px 且宽 ≥ 高 × 1.15 走三栏,宽 < 400px 走紧凑页签,其余走纵向堆叠(宽度说了算,高度没有否决权)。自由浮窗、移动端抽屉同样自适应。 ## 功能一览 | 区域 | 能力 | |---|---| | 动作条 | IDEA 式左侧竖排(底部工作台)/ 顶栏下一行横排(右侧栏):刷新、新建分支、签出、删除、比较、显示差异、贮藏、新建标签、收藏、抓取、拉取、推送。**按可用空间自动决定放几个**,放不下的收进 `⋯ 更多`;末尾 `⚙ 设置` 可拖动排序、逐项显隐(存 `dsh-ide-git.rail.v1`)。每个按钮按当前状态点亮/置灰(没有其他分支就不能删除/签出/比较,没有远程就不能抓取/推送,没有上游就不能拉取,没有变更就没有差异可看) | +| 窄栏页签 | 宽度 < 400px 时:变更列表固定在上方,下方是「历史 / 差异」两个页签——点变更文件自动切到「差异」,历史列表不再被顶走;两区之间的分隔条可拖动、双击复位(尺寸与 `dsh-ide-git.panes.v1` 其它面板同一份存储) | | 悬停提示 | 鼠标停在图标按钮上 120ms,指针旁弹出它的操作名——竖排动作条里在图标右侧(跟着该行垂直居中,贴窗口右缘时翻到左侧),其余在下方;置灰的动作连原因一起给出(如 `隐藏 · 当前状态不可用`)。提示卡挂在窗口层,底部工作台裁不到;扫过一排图标不闪,按住鼠标拖拽 / 滚动 / 缩放时立即收起 | | 状态行 | 当前分支、上游、`↑ahead ↓behind`、stash 数量、忙碌指示 | | 输入框状态条 | 宿主输入框工具条里的仓库/分支胶囊(着色 ±未提交 / ↓可拉取 / ↑待推送),点击切换仓库与分支,与面板双向联动;单仓库只切分支,多仓库两边都切;设置可关(默认开) | diff --git a/README_EN.md b/README_EN.md index 1b81503..14d3dc3 100644 --- a/README_EN.md +++ b/README_EN.md @@ -77,12 +77,14 @@ The same panel shows up on surfaces of very different shapes, so the layout meas |---|---|---| | Right sidebar (native, or bridged by better-sidebar) | narrow + tall | `stack`: changes above the graph, collapsible branch pane | | Bottom workbench (better-sidebar only) | wide + flat | `columns`: tree / graph / changes — the JetBrains Git tool window shape | +| Sidebar dragged very narrow (< 400px) | narrow | `compact`: changes on top, history and diff as two tabs below, collapsible tree | -The panel never guesses: it measures itself with a `ResizeObserver` (width ≥ 600px and width ≥ 1.15 × height → columns, otherwise stack — width decides, height has no veto), so free-floating windows and the mobile drawer adapt too. +The panel never guesses: it measures itself with a `ResizeObserver` (width ≥ 600px and width ≥ 1.15 × height → columns, width < 400px → the compact tabs, otherwise stack — width decides, height has no veto), so free-floating windows and the mobile drawer adapt too. ## Features - Action rail: the JetBrains-style vertical strip in the bottom workbench (and one horizontal row under the header in the right sidebar) with refresh, new branch, checkout, delete, compare, show diff, stash, new tag, favorite, fetch, pull and push. **It shows as many buttons as fit**, folds the rest into a `⋯ more` menu, and pins a `⚙ settings` button that lets you reorder actions and toggle each of them (stored in `dsh-ide-git.rail.v1`). Every action lights up or greys out with the current state (no other branch → delete / checkout / compare off, no remote → fetch / push off, no upstream → pull off, no changes → diff off). +- Compact tabs: below 400px the changes list keeps the top of the panel and the lower window is a `History` / `Diff` tab pair — opening a changed file switches to `Diff`, so the history list is never pushed away; the divider between the two drags and double-click resets (same store as the other panes, `dsh-ide-git.panes.v1`). - Hover hints: rest the pointer on an icon button for 120ms and its action name appears beside it — to the RIGHT of a vertical rail icon (centred on that row, flipping to the left when the window's right edge is in the way) and below everywhere else; greyed-out actions explain themselves too (e.g. `Hide · Not available in the current state`). The hint card lives on the window layer, so the bottom workbench cannot clip it — sweeping across a row of icons does not flash, and a pressed pointer / scroll / resize drops it immediately. - Status line: branch, upstream, ahead/behind, stash count, busy indicator. - Composer status pill: repository/branch capsule in the host input-bar tool row (colored uncommitted / pullable / to-push counters), click to switch repo and branch — kept in sync with the panel both ways; single-repo workspaces switch branches only, multi-repo workspaces switch both. Off-switch in the settings (on by default). Sessions are pre-warmed on switch so the panel opens instantly. diff --git a/dsh.plugin.json b/dsh.plugin.json index 73d1fd1..41a9823 100644 --- a/dsh.plugin.json +++ b/dsh.plugin.json @@ -1,6 +1,6 @@ { "id": "dsh-external/dsh-ide-git", - "version": "0.25.2", + "version": "0.26.0", "main": "./src/index.js", "description": "IDE 级 Git 操作面板:分支树 + 提交图谱 + 变更/暂存/提交 + 提交详情。装了 dsh-better-sidebar 时挂成它的原生 tab(右侧栏 + 底部工作台);没装时直接挂 DSH 原生右侧栏,单独安装即可用。JetBrains 风格 Git 工具窗口 for DeepSeek Harness.", "engines": { diff --git a/package.json b/package.json index 7729962..840e0a5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dsh-ide-git", - "version": "0.25.2", + "version": "0.26.0", "description": "DSH plugin: an IDE-grade Git tool window as a native dsh-better-sidebar tab — branch tree, commit graph, changes, commit details, JetBrains-style actions, in the right sidebar and the bottom panel. | DSH 插件:IDE 级 Git 工具窗口,以 dsh-better-sidebar 原生 Tab 挂载——分支树 / 提交图谱 / 变更与提交详情 / JetBrains 风格操作,右侧栏与底部面板双布局自适应。", "type": "module", "repository": { diff --git a/scripts/dock-probe.mjs b/scripts/dock-probe.mjs index 3479428..da4681f 100644 --- a/scripts/dock-probe.mjs +++ b/scripts/dock-probe.mjs @@ -139,7 +139,7 @@ async function readPanel() { pressed: node.getAttribute('aria-pressed'), label: node.getAttribute('title'), disabled: node.disabled === true, - inHeader: node.closest('.dig-compact-bar') !== null, + inHeader: node.closest('.dig-compact-tabs') !== null, })) const tree = root.querySelector('[data-pane="tree"]') return { @@ -268,13 +268,13 @@ try { const narrow = await readPanel() log('narrow: panel ' + narrow.panel[2] + ' chrome=' + narrow.chrome + ' header tree=' + JSON.stringify(action(narrow, 'tree').filter((entry) => entry.inHeader))) check(narrow.chrome === 'compact', 'the panel is in the compact chrome (' + narrow.chrome + ')') - const headerButton = page.locator('.dig-root:visible .dig-compact-bar [data-action="tree"]').first() + const headerButton = page.locator('.dig-root:visible .dig-compact-tabs [data-action="tree"]').first() check(await headerButton.count() === 1, 'the compact header carries a tree control') await headerButton.click({ timeout: 6000 }) await settle(1200) const headerFolded = await readPanel() check(headerFolded.tree === null, 'it folded the tree') - const stillThere = page.locator('.dig-root:visible .dig-compact-bar [data-action="tree"]').first() + const stillThere = page.locator('.dig-root:visible .dig-compact-tabs [data-action="tree"]').first() check(await stillThere.count() === 1, 'and it is STILL THERE while the tree is folded (the deadlock that made a folded tree unrecoverable)') check(action(headerFolded, 'tree').filter((entry) => entry.inHeader)[0].pressed === 'false', 'reporting the folded state') await stillThere.click({ timeout: 6000 }) diff --git a/src/client.js b/src/client.js index aa4e171..cb3d083 100644 --- a/src/client.js +++ b/src/client.js @@ -10,7 +10,7 @@ * * columns wide and tall enough : repo/branch bar | tree | graph | changes * stack narrow and tall : changes over graph, collapsible tree - * compact short or very narrow : one header row + a Changes/History switch + * compact very narrow : changes on top + a tabbed history/diff window * * Theming: no hard-coded surfaces. Every surface is a --dsw-alias-* token, so * transparent themes and background plugins (dsh-any-background) show through, @@ -8853,7 +8853,11 @@ window.__ModuleLoader__.load({ const PANE_CHROME_KEYS = { columns: ['tree', 'changes', 'diff'], stack: ['tree', 'changes', 'diff'], - compact: ['tree', 'diff'], + /* v0.26.0: the compact chrome stacks the changes list over a TABBED + (history | diff) window instead of splitting the diff out of the + history pane, so the two panes it hands out a divider for are the + tree and the changes list — the diff fills the tab body. */ + compact: ['tree', 'changes'], } /* Whether a key measures a height (stacked chromes) or a width (columns). This is the chrome's DEFAULT for the tree/changes panes; the diff pane @@ -8871,7 +8875,7 @@ window.__ModuleLoader__.load({ 'stack:changes': { min: 120, max: 460 }, 'stack:diff': { min: 120, max: 900 }, 'compact:tree': { min: 100, max: 420 }, - 'compact:diff': { min: 120, max: 900 }, + 'compact:changes': { min: 120, max: 460 }, } /* Today's fixed sizes stay the default — and stay in the stylesheet: a pane the user never dragged keeps exactly the look it had before, while a @@ -8884,6 +8888,7 @@ window.__ModuleLoader__.load({ 'stack:tree': { ratio: 0.36 }, 'stack:changes': { ratio: 0.46 }, 'compact:tree': { ratio: 0.42 }, + 'compact:changes': { ratio: 0.46 }, } const PANE_MAIN_MIN_W = 240 const PANE_MAIN_MIN_H = 150 @@ -8899,7 +8904,7 @@ window.__ModuleLoader__.load({ history↔diff separator lives inside the middle pane, so it is not counted against the body's own budget. */ const PANE_GUTTER_PX = 8 - const PANE_BODY_GUTTERS = { columns: 2, stack: 2, compact: 1 } + const PANE_BODY_GUTTERS = { columns: 2, stack: 2, compact: 2 } const PANE_BUCKETS = Object.keys(PANE_CHROME_KEYS).reduce( (all, chrome) => all.concat([chrome + ':wide', chrome + ':tall']), []) @@ -13167,6 +13172,13 @@ window.__ModuleLoader__.load({ const [selectedPath, setSelectedPath] = useState(null) const [patch, setPatch] = useState('') const [patchLoading, setPatchLoading] = useState(false) + /* The compact chrome's lower window is tabbed (history | diff) instead of + split, so opening a file does not take the history list away: the diff + gets its own tab and the user can switch back (v0.26.0). */ + const [splitTab, setSplitTab] = useState('history') + useEffect(() => { + if (splitTab === 'diff' && patch === '' && patchLoading === false) setSplitTab('history') + }, [splitTab, patch, patchLoading]) /* What the open diff pane shows (v0.13.5): the pane is shared by the commit detail (hash + subject) and the working tree (staged or not), and the selection menu's payload must say which. Cleared everywhere @@ -13944,6 +13956,8 @@ window.__ModuleLoader__.load({ /* The pane header names the file; its close button clears the selection again, so the inline path owns selectedPath here too. */ setSelectedPath(seed.path === undefined ? null : seed.path) + /* Compact chrome: the diff lives in a tab, so opening a file shows it. */ + setSplitTab('diff') if (seed.hash !== undefined && seed.hash !== null) { setDiffContext({ kind: 'commit', hash: seed.hash, subject: seed.subject || '' }) void openDiff({ hash: seed.hash, path: seed.path }) @@ -14861,7 +14875,7 @@ window.__ModuleLoader__.load({ type: 'button', className: 'dig-icon-btn', title: t('toast.close'), - onClick: () => { setPatch(''); setSelectedPath(null); setDiffContext(null) }, + onClick: () => { setPatch(''); setSelectedPath(null); setDiffContext(null); setSplitTab('history') }, }, E(Icon, { name: 'close', size: 12 }))), E(DiffBody, { patch: patch, loading: patchLoading, t: t })) const diffPane = diffPaneOf(false) @@ -15412,33 +15426,51 @@ window.__ModuleLoader__.load({ onRemove: (tree) => setDialog({ kind: 'worktreeRemove', tree: tree, force: false }), })) } else if (compact) { + /* v0.26.0: the changes list sits on TOP and the lower window is a tab + pair (history | diff) instead of a split — opening a file no longer + takes the history list away, and the changes list never disappears. + The diff tab only exists while there is a patch to show. */ + const fillDiff = diffPaneOf(true) + const noDiff = patch === '' && patchLoading === false body = E('div', { className: 'dig-body dig-body-compact', ref: bodyRef }, - E('div', { className: 'dig-compact-bar' }, - E(Segmented, { - value: view === 'detail' ? 'history' : view, - onChange: (next) => { setView(next); setPatch(''); setDiffContext(null) }, - items: [ - { id: 'changes', label: fill(t('seg.changes'), { n: dirty }) }, - { id: 'history', label: t('seg.history') }, - ], - }), - E('span', { className: 'dig-topbar-spacer' }), - // Two-way on purpose: treeOpen is persisted, so a header button that - // only rendered while the tree was OPEN left a folded tree with no way - // back on this chrome (the rail now carries one too, for the others). - E('button', { - type: 'button', - className: 'dig-icon-btn' + (treeOpen ? ' dig-icon-btn-active' : ''), - 'data-action': 'tree', - 'aria-pressed': treeOpen ? 'true' : 'false', - title: t('toolbar.tree'), - onClick: () => foldTree(!treeOpen), - }, E(Icon, { name: treeOpen ? 'eye' : 'eyeOff' }))), treeOpen ? E('div', { className: 'dig-compact-tree', 'data-pane': 'tree', style: paneStyle('tree') }, E(BranchTree, { t: t, branches: branches, favorites: favorites, onCheckout: checkout, onBrowse: browseBranch, onBranchMenu: branchMenu, onDeleteEntries: deleteBranchEntries, onCopyValues: copyValues, onPicksChange: onBranchPicks, clearSignal: pickEpochs.tree })) : null, treeOpen ? gutter('tree', 'prev') : null, - view === 'changes' - ? (patch === '' && patchLoading === false ? changesPane : E('div', { className: 'dig-pane dig-pane-main' }, diffPaneOf(true))) - : E('div', { className: 'dig-pane dig-pane-main' }, historyPane, diffGutter, diffPane)) + E('div', { className: 'dig-pane dig-pane-changes-stack', 'data-pane': 'changes', style: paneStyle('changes') }, changesPane), + gutter('changes', 'prev'), + E('div', { className: 'dig-pane dig-pane-main' }, + E('div', { className: 'dig-compact-tabs' }, + // The changes head is hidden on this chrome, so its count rides + // here instead of above the list. + E('span', { className: 'dig-compact-count' }, fill(t('seg.changes'), { n: dirty })), + E('button', { + type: 'button', + className: 'dig-tab', + 'data-active': splitTab === 'history' ? 'true' : 'false', + 'data-action': 'history-tab', + onClick: () => setSplitTab('history'), + }, t('seg.history')), + E('button', { + type: 'button', + className: 'dig-tab', + 'data-active': splitTab === 'diff' ? 'true' : 'false', + 'data-action': 'diff-tab', + disabled: noDiff, + title: noDiff ? t('diff.empty') : t('diff.codeLabel'), + onClick: () => setSplitTab('diff'), + }, t('diff.codeLabel')), + E('span', { className: 'dig-topbar-spacer' }), + // Two-way on purpose: treeOpen is persisted, so a header button that + // only rendered while the tree was OPEN left a folded tree with no way + // back on this chrome (the rail now carries one too, for the others). + E('button', { + type: 'button', + className: 'dig-icon-btn' + (treeOpen ? ' dig-icon-btn-active' : ''), + 'data-action': 'tree', + 'aria-pressed': treeOpen ? 'true' : 'false', + title: t('toolbar.tree'), + onClick: () => foldTree(!treeOpen), + }, E(Icon, { name: treeOpen ? 'eye' : 'eyeOff' }))), + splitTab === 'diff' && fillDiff !== null ? fillDiff : historyPane)) } else if (columns) { body = E('div', { className: 'dig-body dig-body-columns', ref: bodyRef }, treeOpen ? E('div', { className: 'dig-pane dig-pane-tree', 'data-pane': 'tree', style: paneStyle('tree') }, E(BranchTree, { t: t, branches: branches, favorites: favorites, onCheckout: checkout, onBrowse: browseBranch, onBranchMenu: branchMenu, onDeleteEntries: deleteBranchEntries, onCopyValues: copyValues, onPicksChange: onBranchPicks, clearSignal: pickEpochs.tree })) : null, @@ -15968,7 +16000,15 @@ window.__ModuleLoader__.load({ '.dig-pane-main{flex:1;min-width:0}', '.dig-pane-changes{width:290px;flex:none;border-left:1px solid var(--dsw-alias-border-l2)}', '.dig-pane-changes-stack{max-height:46%;flex:none;border-bottom:1px solid var(--dsw-alias-border-l2)}', - '.dig-compact-bar{display:flex;align-items:center;gap:6px;padding:4px 6px;flex:none}', + /* v0.26.0: the compact chrome stacks changes over a tabbed window, so the + old switch bar became the tab strip of that window. */ + '.dig-compact-tabs{display:flex;align-items:center;gap:4px;padding:4px 6px;flex:none;border-bottom:1px solid var(--dsw-alias-border-l2)}', + '.dig-compact-count{color:var(--dsw-alias-label-secondary);font-weight:500;font-size:11px;padding:0 2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:45%}', + '.dig-tab{border:none;background:transparent;color:var(--dsw-alias-label-secondary);font:inherit;font-size:11px;font-weight:500;padding:2px 10px;border-radius:var(--dsw-radius-sm,8px);cursor:pointer;white-space:nowrap;flex:none}', + '.dig-tab:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}', + '.dig-tab[data-active="true"]{background:var(--dsw-alias-bg-layer-2,var(--dsw-alias-bg-layer-1));color:var(--dsw-alias-label-primary)}', + '.dig-tab:disabled{opacity:.45;cursor:default}', + '.dig-tab:disabled:hover{background:transparent;color:var(--dsw-alias-label-secondary)}', '.dig-compact-tree{max-height:42%;flex:none;border-bottom:1px solid var(--dsw-alias-border-l2)}', // A divider: an 8px hit area (a fingertip needs it) painted as a 1px hairline // that lights up on hover, focus or while dragging. touch-action:none is what diff --git a/tests/smoke.mjs b/tests/smoke.mjs index b45b17a..fad38e3 100644 --- a/tests/smoke.mjs +++ b/tests/smoke.mjs @@ -911,7 +911,7 @@ test('the tree toggle is reachable again after it was folded', () => { // was OPEN left a folded tree with no way back (a workspace could only be // repaired by clearing localStorage). The header button is two-way now, and the // rail carries the action for the chromes that have no header button. - const bar = client.slice(client.indexOf("className: 'dig-compact-bar'"), client.indexOf("className: 'dig-compact-bar'") + 1400) + const bar = client.slice(client.indexOf("className: 'dig-compact-tabs'"), client.indexOf("className: 'dig-compact-tabs'") + 1800) assert.match(bar, /'data-action': 'tree'/, 'the compact header keeps a tree control') assert.match(bar, /onClick: \(\) => foldTree\(!treeOpen\)/, 'and it toggles BOTH ways') assert.match(bar, /'aria-pressed': treeOpen \? 'true' : 'false'/) @@ -2096,8 +2096,14 @@ test('clicking a changed file shows its diff in every chrome (v0.25.1)', () => { 'a plain click on a changed file opens its diff') assert.match(client, /'dig-diff-pane' \+ \(fill === true \? ' dig-diff-pane-fill' : ''\)/, 'the compact chrome can render a filling diff pane') - assert.match(client, /view === 'changes'\n\s+\? \(patch === '' && patchLoading === false \? changesPane/, - 'the compact changes tab swaps to the diff when a patch is loaded') + assert.match(client, /splitTab === 'diff' && fillDiff !== null \? fillDiff : historyPane/, + 'the compact diff is a tab beside the history window (v0.26.0)') + assert.match(client, /'data-action': 'diff-tab'/, 'the compact chrome has a diff tab') + assert.match(client, /'data-action': 'history-tab'/, 'and a history tab next to it') + assert.match(client, /E\('div', \{ className: 'dig-pane dig-pane-changes-stack', 'data-pane': 'changes', style: paneStyle\('changes'\) \}, changesPane\)/, + 'the changes list keeps the top of the compact chrome') + assert.match(client, /compact: \['tree', 'changes'\]/, + 'the compact chrome hands its divider to the changes list, not the tabbed diff') assert.match(client, /const diffPaneOf = \(fill\) => [^\n]*style: fill === true \? null : paneStyle\('diff'\)/, 'the split pane still consumes the stored size') assert.match(client, /setSelectedPath\(seed\.path === undefined \? null : seed\.path\)/, From a725b7d37b745fc7d21283ea0b1015b79a3f7058 Mon Sep 17 00:00:00 2001 From: wwei-gtihub <418047394@qq.com> Date: Wed, 4 Nov 2026 15:12:59 +0800 Subject: [PATCH 4/6] =?UTF-8?q?fix(v0.26.1):=20=E5=A0=86=E5=8F=A0=E5=B8=83?= =?UTF-8?q?=E5=B1=80=EF=BC=88400=E2=80=93600px=EF=BC=89=E7=9A=84=E5=8E=86?= =?UTF-8?q?=E5=8F=B2/=E5=B7=AE=E5=BC=82=E4=B9=9F=E5=81=9A=E6=88=90?= =?UTF-8?q?=E9=A1=B5=E7=AD=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit v0.26.0 只把紧凑 chrome(< 400px)改成页签,右侧栏最常用的「窄而高」堆叠布局仍是历史列表 + 底部 diff 分屏:点变更文件时 diff 从下面挤出来、历史被压走。用户反馈「改错了」指的就是这块——提交框下面的区域应该就是「提交历史 / 差异对比」两个页签。 - stack 与 compact 共用页签条构造器 splitTabs(withCount, withTree)(.dig-split-tabs):页签「历史 | 差异」,无 patch 时差异置灰并给 title,点变更文件自动切差异,关掉 diff 落回历史 - 紧凑 chrome 额外把「变更 N」计数与树开关放进这条;堆叠 chrome 只放页签 - PANE_CHROME_KEYS.stack 由 ['tree','changes','diff'] 改成 ['tree','changes'],删掉 stack:diff 限制;diff 不再独立成窗格,改为填满页签主体(.dig-diff-pane-fill) - 三栏 chrome 保持原样:中间栏历史在上、diff 在下,分隔条可拖 - 同步更新两份 README、dock-probe 选择器与 smoke 断言 验证:npm test 125/125、node --check 通过。 --- CHANGELOG.md | 10 ++++ README.md | 6 +-- README_EN.md | 6 +-- dsh.plugin.json | 2 +- package.json | 2 +- scripts/dock-probe.mjs | 6 +-- src/client.js | 103 ++++++++++++++++++++++------------------- tests/smoke.mjs | 23 ++++++--- 8 files changed, 94 insertions(+), 64 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7af4704..9c6f55c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,16 @@ > 倒序排列,新版本条目在最上面。条目格式:`## vX.Y.Z — YYYY-MM-DD` + 类型(feat / fix / docs / chore)+ 要点 + 相关链接。 > 纪律见 AGENTS.md「变更记录纪律」:发版前先更新本文件并随版本提交。 +## v0.26.1 — 2026-11-04 + +**类型**:fix(堆叠布局的「历史 / 差异」也做成页签) + +- **背景**:v0.26.0 只把紧凑 chrome(宽 < 400px)改成页签;右侧栏最常用的「窄而高」堆叠布局(`stack`,400–600px)仍是历史列表 + 底部 diff 分屏——点变更文件时 diff 从下面挤出来,历史被压走。用户反馈「改错了」指的就是这块:提交框下面的区域应该就是「提交历史 / 差异对比」两个页签。 +- **布局**:`stack` 与 `compact` 现在共用同一个页签条构造器 `splitTabs(withCount, withTree)`(`.dig-split-tabs`)。页签「历史 | 差异」;没有 patch 时「差异」置灰并用 `title` 说明原因;点变更文件自动切到「差异」,关掉 diff 自动落回「历史」。紧凑 chrome 额外把「变更 N」计数与树开关放在这条里(它的变更头是隐藏的),堆叠 chrome 只放页签。 +- **面板几何**:`PANE_CHROME_KEYS.stack` 由 `['tree','changes','diff']` 改为 `['tree','changes']`,删掉 `stack:diff` 限制;diff 不再是一个独立窗格,而是填满页签主体(`.dig-diff-pane-fill`)。三栏 chrome 保持原样:中间栏仍是历史在上、diff 在下,分隔条可拖。 +- **同时更新**:两份 README 的布局表/功能表、`scripts/dock-probe.mjs` 的探针选择器(`.dig-compact-tabs` → `.dig-split-tabs`)、smoke 测试里「堆叠 chrome 有独立 diff 窗格」的断言改为页签断言。 +- **验证**:`npm test` 125/125(改 3 条、增 3 条断言:堆叠 chrome 的页签、pane key、diff 只剩三栏一份);`node --check src/client.js`。纯布局改动,headless 量不到真机像素,需要重启 App 后目测。 + ## v0.26.0 — 2026-11-04 **类型**:feat(窄栏改成「变更在上、历史/差异页签在下」) diff --git a/README.md b/README.md index 2d44ee4..90b9af1 100644 --- a/README.md +++ b/README.md @@ -85,18 +85,18 @@ DSH 自带的 Git 面板覆盖「暂存 / 提交 / 还原 / 看历史」;`dsh-id | 面 | 形态 | 本插件的布局 | |---|---|---| -| 右侧栏(原生的,或底座桥接过来的) | 窄而高 | `stack`:变更区在提交历史之上,分支树可收起,详情/差异占满主区 | +| 右侧栏(原生的,或底座桥接过来的) | 窄而高 | `stack`:变更区在上,下方是「历史 / 差异」双页签(点变更文件自动切到差异),分支树可收起 | | 底部工作台(底座自有) | 宽而扁 | `columns`:分支树 · 提交图谱 · 变更与提交框,三栏并排——就是 JetBrains Git 工具窗口的样子 | | 侧栏被拖得很窄(< 400px) | 窄 | `compact`:变更列表在上,下方是「历史 / 差异」双页签,分支树可收起 | -插件不猜自己在哪儿,而是用 `ResizeObserver` 量自己的容器:宽 ≥ 600px 且宽 ≥ 高 × 1.15 走三栏,宽 < 400px 走紧凑页签,其余走纵向堆叠(宽度说了算,高度没有否决权)。自由浮窗、移动端抽屉同样自适应。 +插件不猜自己在哪儿,而是用 `ResizeObserver` 量自己的容器:宽 ≥ 600px 且宽 ≥ 高 × 1.15 走三栏,宽 < 400px 走紧凑页签,其余走纵向堆叠(宽度说了算,高度没有否决权);两种纵向布局都把「历史 / 差异」做成页签,点变更文件自动切到差异。自由浮窗、移动端抽屉同样自适应。 ## 功能一览 | 区域 | 能力 | |---|---| | 动作条 | IDEA 式左侧竖排(底部工作台)/ 顶栏下一行横排(右侧栏):刷新、新建分支、签出、删除、比较、显示差异、贮藏、新建标签、收藏、抓取、拉取、推送。**按可用空间自动决定放几个**,放不下的收进 `⋯ 更多`;末尾 `⚙ 设置` 可拖动排序、逐项显隐(存 `dsh-ide-git.rail.v1`)。每个按钮按当前状态点亮/置灰(没有其他分支就不能删除/签出/比较,没有远程就不能抓取/推送,没有上游就不能拉取,没有变更就没有差异可看) | -| 窄栏页签 | 宽度 < 400px 时:变更列表固定在上方,下方是「历史 / 差异」两个页签——点变更文件自动切到「差异」,历史列表不再被顶走;两区之间的分隔条可拖动、双击复位(尺寸与 `dsh-ide-git.panes.v1` 其它面板同一份存储) | +| 窄栏页签 | 宽度 < 600px 的两种纵向布局里:变更列表固定在上方,下方是「历史 / 差异」两个页签——点变更文件自动切到「差异」,历史列表与它的滚动位置都不再被顶走;两区之间的分隔条可拖动、双击复位(尺寸与 `dsh-ide-git.panes.v1` 其它面板同一份存储) | | 悬停提示 | 鼠标停在图标按钮上 120ms,指针旁弹出它的操作名——竖排动作条里在图标右侧(跟着该行垂直居中,贴窗口右缘时翻到左侧),其余在下方;置灰的动作连原因一起给出(如 `隐藏 · 当前状态不可用`)。提示卡挂在窗口层,底部工作台裁不到;扫过一排图标不闪,按住鼠标拖拽 / 滚动 / 缩放时立即收起 | | 状态行 | 当前分支、上游、`↑ahead ↓behind`、stash 数量、忙碌指示 | | 输入框状态条 | 宿主输入框工具条里的仓库/分支胶囊(着色 ±未提交 / ↓可拉取 / ↑待推送),点击切换仓库与分支,与面板双向联动;单仓库只切分支,多仓库两边都切;设置可关(默认开) | diff --git a/README_EN.md b/README_EN.md index 14d3dc3..7fb54ab 100644 --- a/README_EN.md +++ b/README_EN.md @@ -75,16 +75,16 @@ The same panel shows up on surfaces of very different shapes, so the layout meas | Surface | Shape | Layout here | |---|---|---| -| Right sidebar (native, or bridged by better-sidebar) | narrow + tall | `stack`: changes above the graph, collapsible branch pane | +| Right sidebar (native, or bridged by better-sidebar) | narrow + tall | `stack`: changes on top, history and diff as two tabs below (a click on a file switches to `Diff`), collapsible branch pane | | Bottom workbench (better-sidebar only) | wide + flat | `columns`: tree / graph / changes — the JetBrains Git tool window shape | | Sidebar dragged very narrow (< 400px) | narrow | `compact`: changes on top, history and diff as two tabs below, collapsible tree | -The panel never guesses: it measures itself with a `ResizeObserver` (width ≥ 600px and width ≥ 1.15 × height → columns, width < 400px → the compact tabs, otherwise stack — width decides, height has no veto), so free-floating windows and the mobile drawer adapt too. +The panel never guesses: it measures itself with a `ResizeObserver` (width ≥ 600px and width ≥ 1.15 × height → columns, width < 400px → the compact tabs, otherwise stack — width decides, height has no veto); both stacked layouts make history and diff tabs, and a click on a changed file flips to `Diff`. Free-floating windows and the mobile drawer adapt too. ## Features - Action rail: the JetBrains-style vertical strip in the bottom workbench (and one horizontal row under the header in the right sidebar) with refresh, new branch, checkout, delete, compare, show diff, stash, new tag, favorite, fetch, pull and push. **It shows as many buttons as fit**, folds the rest into a `⋯ more` menu, and pins a `⚙ settings` button that lets you reorder actions and toggle each of them (stored in `dsh-ide-git.rail.v1`). Every action lights up or greys out with the current state (no other branch → delete / checkout / compare off, no remote → fetch / push off, no upstream → pull off, no changes → diff off). -- Compact tabs: below 400px the changes list keeps the top of the panel and the lower window is a `History` / `Diff` tab pair — opening a changed file switches to `Diff`, so the history list is never pushed away; the divider between the two drags and double-click resets (same store as the other panes, `dsh-ide-git.panes.v1`). +- Tabs in the stacked layouts: below 600px (both `stack` and `compact`) the changes list keeps the top of the panel and the lower window is a `History` / `Diff` tab pair — opening a changed file switches to `Diff`, so the history list (and its scroll position) is never pushed away; the divider above that window drags and double-click resets (same store as the other panes, `dsh-ide-git.panes.v1`). - Hover hints: rest the pointer on an icon button for 120ms and its action name appears beside it — to the RIGHT of a vertical rail icon (centred on that row, flipping to the left when the window's right edge is in the way) and below everywhere else; greyed-out actions explain themselves too (e.g. `Hide · Not available in the current state`). The hint card lives on the window layer, so the bottom workbench cannot clip it — sweeping across a row of icons does not flash, and a pressed pointer / scroll / resize drops it immediately. - Status line: branch, upstream, ahead/behind, stash count, busy indicator. - Composer status pill: repository/branch capsule in the host input-bar tool row (colored uncommitted / pullable / to-push counters), click to switch repo and branch — kept in sync with the panel both ways; single-repo workspaces switch branches only, multi-repo workspaces switch both. Off-switch in the settings (on by default). Sessions are pre-warmed on switch so the panel opens instantly. diff --git a/dsh.plugin.json b/dsh.plugin.json index 41a9823..9e1eb1a 100644 --- a/dsh.plugin.json +++ b/dsh.plugin.json @@ -1,6 +1,6 @@ { "id": "dsh-external/dsh-ide-git", - "version": "0.26.0", + "version": "0.26.1", "main": "./src/index.js", "description": "IDE 级 Git 操作面板:分支树 + 提交图谱 + 变更/暂存/提交 + 提交详情。装了 dsh-better-sidebar 时挂成它的原生 tab(右侧栏 + 底部工作台);没装时直接挂 DSH 原生右侧栏,单独安装即可用。JetBrains 风格 Git 工具窗口 for DeepSeek Harness.", "engines": { diff --git a/package.json b/package.json index 840e0a5..0f8e368 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dsh-ide-git", - "version": "0.26.0", + "version": "0.26.1", "description": "DSH plugin: an IDE-grade Git tool window as a native dsh-better-sidebar tab — branch tree, commit graph, changes, commit details, JetBrains-style actions, in the right sidebar and the bottom panel. | DSH 插件:IDE 级 Git 工具窗口,以 dsh-better-sidebar 原生 Tab 挂载——分支树 / 提交图谱 / 变更与提交详情 / JetBrains 风格操作,右侧栏与底部面板双布局自适应。", "type": "module", "repository": { diff --git a/scripts/dock-probe.mjs b/scripts/dock-probe.mjs index da4681f..b9c4338 100644 --- a/scripts/dock-probe.mjs +++ b/scripts/dock-probe.mjs @@ -139,7 +139,7 @@ async function readPanel() { pressed: node.getAttribute('aria-pressed'), label: node.getAttribute('title'), disabled: node.disabled === true, - inHeader: node.closest('.dig-compact-tabs') !== null, + inHeader: node.closest('.dig-split-tabs') !== null, })) const tree = root.querySelector('[data-pane="tree"]') return { @@ -268,13 +268,13 @@ try { const narrow = await readPanel() log('narrow: panel ' + narrow.panel[2] + ' chrome=' + narrow.chrome + ' header tree=' + JSON.stringify(action(narrow, 'tree').filter((entry) => entry.inHeader))) check(narrow.chrome === 'compact', 'the panel is in the compact chrome (' + narrow.chrome + ')') - const headerButton = page.locator('.dig-root:visible .dig-compact-tabs [data-action="tree"]').first() + const headerButton = page.locator('.dig-root:visible .dig-split-tabs [data-action="tree"]').first() check(await headerButton.count() === 1, 'the compact header carries a tree control') await headerButton.click({ timeout: 6000 }) await settle(1200) const headerFolded = await readPanel() check(headerFolded.tree === null, 'it folded the tree') - const stillThere = page.locator('.dig-root:visible .dig-compact-tabs [data-action="tree"]').first() + const stillThere = page.locator('.dig-root:visible .dig-split-tabs [data-action="tree"]').first() check(await stillThere.count() === 1, 'and it is STILL THERE while the tree is folded (the deadlock that made a folded tree unrecoverable)') check(action(headerFolded, 'tree').filter((entry) => entry.inHeader)[0].pressed === 'false', 'reporting the folded state') await stillThere.click({ timeout: 6000 }) diff --git a/src/client.js b/src/client.js index cb3d083..e236fb0 100644 --- a/src/client.js +++ b/src/client.js @@ -9,8 +9,8 @@ * chrome: * * columns wide and tall enough : repo/branch bar | tree | graph | changes - * stack narrow and tall : changes over graph, collapsible tree - * compact very narrow : changes on top + a tabbed history/diff window + * stack narrow and tall : changes over a tabbed history/diff window + * compact very narrow : changes on top + the same tabbed window * * Theming: no hard-coded surfaces. Every surface is a --dsw-alias-* token, so * transparent themes and background plugins (dsh-any-background) show through, @@ -8852,11 +8852,11 @@ window.__ModuleLoader__.load({ panes measure width (columns). */ const PANE_CHROME_KEYS = { columns: ['tree', 'changes', 'diff'], - stack: ['tree', 'changes', 'diff'], - /* v0.26.0: the compact chrome stacks the changes list over a TABBED - (history | diff) window instead of splitting the diff out of the - history pane, so the two panes it hands out a divider for are the - tree and the changes list — the diff fills the tab body. */ + /* v0.26.1: BOTH stacked chromes put the history list and the diff in one + TABBED window (history | diff) under the changes list, so the diff is + no longer a pane of its own here — it fills the tab body. Only the + three-column chrome still splits the diff out of the middle column. */ + stack: ['tree', 'changes'], compact: ['tree', 'changes'], } /* Whether a key measures a height (stacked chromes) or a width (columns). @@ -8873,7 +8873,6 @@ window.__ModuleLoader__.load({ 'columns:diff': { min: 120, max: 900 }, 'stack:tree': { min: 100, max: 420 }, 'stack:changes': { min: 120, max: 460 }, - 'stack:diff': { min: 120, max: 900 }, 'compact:tree': { min: 100, max: 420 }, 'compact:changes': { min: 120, max: 460 }, } @@ -15400,9 +15399,46 @@ window.__ModuleLoader__.load({ const worktrees = summary !== null && Array.isArray(summary.worktrees) ? summary.worktrees : [] /* The history↔diff separator only exists while a diff is on screen, and it - lives inside the middle pane — the diff is the pane below it. */ + lives inside the middle pane — the diff is the pane below it. Only the + three-column chrome keeps that split (v0.26.1). */ const diffGutter = diffPane === null ? null : gutter('diff', 'next') + /* v0.26.1 — the stacked chromes (stack and compact) show the history list + and the diff in ONE tabbed window below the changes list: clicking a + file flips that window to the diff tab instead of splitting the diff out + and squeezing the history. `withCount` only matters on compact, whose + changes head (and with it the "changes {n}" badge) is hidden; `withTree` + adds the tree toggle that chrome has no other way to reach. */ + const noDiff = patch === '' && patchLoading === false + const fillDiff = diffPaneOf(true) + const splitTabs = (withCount, withTree) => E('div', { className: 'dig-split-tabs' }, + withCount === true ? E('span', { className: 'dig-compact-count' }, fill(t('seg.changes'), { n: dirty })) : null, + E('button', { + type: 'button', + className: 'dig-tab', + 'data-active': splitTab === 'history' ? 'true' : 'false', + 'data-action': 'history-tab', + onClick: () => setSplitTab('history'), + }, t('seg.history')), + E('button', { + type: 'button', + className: 'dig-tab', + 'data-active': splitTab === 'diff' ? 'true' : 'false', + 'data-action': 'diff-tab', + disabled: noDiff, + title: noDiff ? t('diff.empty') : t('diff.codeLabel'), + onClick: () => setSplitTab('diff'), + }, t('diff.codeLabel')), + E('span', { className: 'dig-topbar-spacer' }), + withTree === true ? E('button', { + type: 'button', + className: 'dig-icon-btn' + (treeOpen ? ' dig-icon-btn-active' : ''), + 'data-action': 'tree', + 'aria-pressed': treeOpen ? 'true' : 'false', + title: t('toolbar.tree'), + onClick: () => foldTree(!treeOpen), + }, E(Icon, { name: treeOpen ? 'eye' : 'eyeOff' })) : null) + let body if (repoState === null) { /* The scan is still running: a neutral loading state, never the @@ -15430,46 +15466,13 @@ window.__ModuleLoader__.load({ pair (history | diff) instead of a split — opening a file no longer takes the history list away, and the changes list never disappears. The diff tab only exists while there is a patch to show. */ - const fillDiff = diffPaneOf(true) - const noDiff = patch === '' && patchLoading === false body = E('div', { className: 'dig-body dig-body-compact', ref: bodyRef }, treeOpen ? E('div', { className: 'dig-compact-tree', 'data-pane': 'tree', style: paneStyle('tree') }, E(BranchTree, { t: t, branches: branches, favorites: favorites, onCheckout: checkout, onBrowse: browseBranch, onBranchMenu: branchMenu, onDeleteEntries: deleteBranchEntries, onCopyValues: copyValues, onPicksChange: onBranchPicks, clearSignal: pickEpochs.tree })) : null, treeOpen ? gutter('tree', 'prev') : null, E('div', { className: 'dig-pane dig-pane-changes-stack', 'data-pane': 'changes', style: paneStyle('changes') }, changesPane), gutter('changes', 'prev'), E('div', { className: 'dig-pane dig-pane-main' }, - E('div', { className: 'dig-compact-tabs' }, - // The changes head is hidden on this chrome, so its count rides - // here instead of above the list. - E('span', { className: 'dig-compact-count' }, fill(t('seg.changes'), { n: dirty })), - E('button', { - type: 'button', - className: 'dig-tab', - 'data-active': splitTab === 'history' ? 'true' : 'false', - 'data-action': 'history-tab', - onClick: () => setSplitTab('history'), - }, t('seg.history')), - E('button', { - type: 'button', - className: 'dig-tab', - 'data-active': splitTab === 'diff' ? 'true' : 'false', - 'data-action': 'diff-tab', - disabled: noDiff, - title: noDiff ? t('diff.empty') : t('diff.codeLabel'), - onClick: () => setSplitTab('diff'), - }, t('diff.codeLabel')), - E('span', { className: 'dig-topbar-spacer' }), - // Two-way on purpose: treeOpen is persisted, so a header button that - // only rendered while the tree was OPEN left a folded tree with no way - // back on this chrome (the rail now carries one too, for the others). - E('button', { - type: 'button', - className: 'dig-icon-btn' + (treeOpen ? ' dig-icon-btn-active' : ''), - 'data-action': 'tree', - 'aria-pressed': treeOpen ? 'true' : 'false', - title: t('toolbar.tree'), - onClick: () => foldTree(!treeOpen), - }, E(Icon, { name: treeOpen ? 'eye' : 'eyeOff' }))), + splitTabs(true, true), splitTab === 'diff' && fillDiff !== null ? fillDiff : historyPane)) } else if (columns) { body = E('div', { className: 'dig-body dig-body-columns', ref: bodyRef }, @@ -15484,7 +15487,12 @@ window.__ModuleLoader__.load({ treeOpen ? gutter('tree', 'prev') : null, E('div', { className: 'dig-pane dig-pane-changes-stack', 'data-pane': 'changes', style: paneStyle('changes') }, changesPane), gutter('changes', 'prev'), - E('div', { className: 'dig-pane dig-pane-main' }, historyPane, diffGutter, diffPane)) + /* v0.26.1: below the commit box the history list and the diff share + one tabbed window — a click on a changed file flips to the diff tab + and leaves the list (and its scroll position) alone. */ + E('div', { className: 'dig-pane dig-pane-main' }, + splitTabs(false, false), + splitTab === 'diff' && fillDiff !== null ? fillDiff : historyPane)) } /* ---------- overlays ---------- */ @@ -16000,9 +16008,10 @@ window.__ModuleLoader__.load({ '.dig-pane-main{flex:1;min-width:0}', '.dig-pane-changes{width:290px;flex:none;border-left:1px solid var(--dsw-alias-border-l2)}', '.dig-pane-changes-stack{max-height:46%;flex:none;border-bottom:1px solid var(--dsw-alias-border-l2)}', - /* v0.26.0: the compact chrome stacks changes over a tabbed window, so the - old switch bar became the tab strip of that window. */ - '.dig-compact-tabs{display:flex;align-items:center;gap:4px;padding:4px 6px;flex:none;border-bottom:1px solid var(--dsw-alias-border-l2)}', + /* v0.26.1: both stacked chromes show history and diff in one tabbed + window; the strip is the window's tab bar (the compact chrome also + hosts the changes count and the tree toggle in it). */ + '.dig-split-tabs{display:flex;align-items:center;gap:4px;padding:4px 6px;flex:none;border-bottom:1px solid var(--dsw-alias-border-l2)}', '.dig-compact-count{color:var(--dsw-alias-label-secondary);font-weight:500;font-size:11px;padding:0 2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:45%}', '.dig-tab{border:none;background:transparent;color:var(--dsw-alias-label-secondary);font:inherit;font-size:11px;font-weight:500;padding:2px 10px;border-radius:var(--dsw-radius-sm,8px);cursor:pointer;white-space:nowrap;flex:none}', '.dig-tab:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}', diff --git a/tests/smoke.mjs b/tests/smoke.mjs index fad38e3..9f22410 100644 --- a/tests/smoke.mjs +++ b/tests/smoke.mjs @@ -910,8 +910,9 @@ test('the tree toggle is reachable again after it was folded', () => { // treeOpen is persisted, so a header button that only rendered while the tree // was OPEN left a folded tree with no way back (a workspace could only be // repaired by clearing localStorage). The header button is two-way now, and the - // rail carries the action for the chromes that have no header button. - const bar = client.slice(client.indexOf("className: 'dig-compact-tabs'"), client.indexOf("className: 'dig-compact-tabs'") + 1800) + // rail carries the action for the chromes that have no header button. v0.26.1 + // moved it into the shared tab-strip builder (compact passes withTree=true). + const bar = client.slice(client.indexOf("className: 'dig-split-tabs'"), client.indexOf("className: 'dig-split-tabs'") + 1800) assert.match(bar, /'data-action': 'tree'/, 'the compact header keeps a tree control') assert.match(bar, /onClick: \(\) => foldTree\(!treeOpen\)/, 'and it toggles BOTH ways') assert.match(bar, /'aria-pressed': treeOpen \? 'true' : 'false'/) @@ -1125,8 +1126,8 @@ test('the pane clamps hold at both ends and never shrink a pane below its own bo const geo = core.paneGeometry('stack', tall, stored) assert.equal(geo.overrides.changes, 440, 'the changes pane stops where the middle pane begins') assert.equal(geo.overrides.tree, 324, 'the tree gives way to the pane it shares the column with') - assert.equal(geo.overrides.diff, 120, 'the diff can never eat the history list') - assert.equal(geo.limits.diff.max, 120) + assert.equal(geo.overrides.diff, undefined, 'the stacked chrome no longer splits a diff pane out (v0.26.1)') + assert.equal(geo.limits.diff, undefined, 'and it announces no diff divider') assert.equal(tall.height - geo.overrides.tree - geo.overrides.changes - 2 * core.PANE_GUTTER_PX, core.PANE_MAIN_FLOOR_PX, 'the middle pane keeps exactly its hard floor when both stacked panes are maxed') @@ -1200,9 +1201,10 @@ test('a divider only exists when it can move something', () => { const columns = core.paneGeometry('columns', { width: 700, height: 400 }, core.normalizePanes(null), { diff: 150 }) assert.ok(columns.limits.diff !== undefined && columns.limits.diff.max > columns.limits.diff.min, 'the columns chrome hands out a real diff window') + assert.deepEqual(core.PANE_CHROME_KEYS.stack, ['tree', 'changes'], + 'the stacked chrome puts history and diff in one tabbed window (v0.26.1)') const stacked = core.paneGeometry('stack', { width: 700, height: 800 }, core.normalizePanes(null), { diff: 150 }) - assert.ok(stacked.limits.diff !== undefined && stacked.limits.diff.max > stacked.limits.diff.min, - 'while the stacked chrome hands out a real diff window') + assert.equal(stacked.limits.diff, undefined, 'so it hands out no diff divider at all') // The columns diff divides the body HEIGHT, not the chrome's own width // dimension: 0.5 of a 400px-tall body lands at 200px even in a 1000px-wide @@ -2104,6 +2106,15 @@ test('clicking a changed file shows its diff in every chrome (v0.25.1)', () => { 'the changes list keeps the top of the compact chrome') assert.match(client, /compact: \['tree', 'changes'\]/, 'the compact chrome hands its divider to the changes list, not the tabbed diff') + // v0.26.1: the stacked chrome (400–600px, the native right sidebar's bread and + // butter) got the same treatment — the diff is a TAB there too, not a window + // squeezed in at the bottom under a shrinking history list. + assert.match(client, /stack: \['tree', 'changes'\]/, + 'the stacked chrome hands its divider to the changes list as well') + assert.match(client, /dig-body-stack[\s\S]{0,1400}splitTabs\(false, false\)/, + 'the stacked chrome renders the shared tab strip above the history window') + assert.equal((client.match(/className: 'dig-pane dig-pane-main' \}, historyPane, diffGutter, diffPane/g) || []).length, 1, + 'only the three-column chrome still splits the diff out under the history') assert.match(client, /const diffPaneOf = \(fill\) => [^\n]*style: fill === true \? null : paneStyle\('diff'\)/, 'the split pane still consumes the stored size') assert.match(client, /setSelectedPath\(seed\.path === undefined \? null : seed\.path\)/, From c11cbe45901ff12d10e105cbedca416fdec3f044 Mon Sep 17 00:00:00 2001 From: wwei-gtihub <418047394@qq.com> Date: Wed, 4 Nov 2026 15:23:19 +0800 Subject: [PATCH 5/6] =?UTF-8?q?fix(v0.26.2):=20=E5=8F=98=E6=9B=B4=E5=A4=B4?= =?UTF-8?q?=E7=9A=84=E6=95=B0=E5=AD=97=E5=9B=9E=E5=88=B0=E3=80=8C=E5=8F=98?= =?UTF-8?q?=E6=9B=B4=E3=80=8D=E5=AD=97=E6=A0=B7=E5=90=8E=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 变更区标题行的计数徽标用的是共享的 .dig-count(带 margin-left:auto),于是「变更」在左、数字被推到行中间偏右。分支/文件夹分组行里这个右对齐是想要的,变更头不是。 新增作用域覆盖 `.dig-changes-head .dig-count{margin-left:0}`,变更头里的数字紧贴标题;分组行不受影响。 验证:npm test 126/126(新增 1 条测试)。 --- CHANGELOG.md | 8 ++++++++ dsh.plugin.json | 2 +- package.json | 2 +- src/client.js | 5 +++++ tests/smoke.mjs | 14 ++++++++++++++ 5 files changed, 29 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c6f55c..9931643 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,14 @@ > 倒序排列,新版本条目在最上面。条目格式:`## vX.Y.Z — YYYY-MM-DD` + 类型(feat / fix / docs / chore)+ 要点 + 相关链接。 > 纪律见 AGENTS.md「变更记录纪律」:发版前先更新本文件并随版本提交。 +## v0.26.2 — 2026-11-04 + +**类型**:fix(变更头的数字回到「变更」字样后面) + +- **背景**:变更区标题行的计数徽标用的是共享的 `.dig-count`(带 `margin-left:auto`),于是 `变更` 在左、数字被推到行中间偏右(分支/文件夹分组行里这个右对齐是想要的,变更头不是)。用户反馈「变更后面的数字不要放中间,放到变更后面」。 +- **改动**:新增作用域覆盖 `.dig-changes-head .dig-count{margin-left:0}`,变更头里的数字紧贴标题;分支树、文件夹分组行不受影响(它们不在 `.dig-changes-head` 里)。 +- **验证**:`npm test` 126/126(新增 1 条测试:共享规则仍在、变更头覆盖存在、徽标绑的就是 `total`);纯 CSS 改动,需重启 App 后目测。 + ## v0.26.1 — 2026-11-04 **类型**:fix(堆叠布局的「历史 / 差异」也做成页签) diff --git a/dsh.plugin.json b/dsh.plugin.json index 9e1eb1a..9b0d767 100644 --- a/dsh.plugin.json +++ b/dsh.plugin.json @@ -1,6 +1,6 @@ { "id": "dsh-external/dsh-ide-git", - "version": "0.26.1", + "version": "0.26.2", "main": "./src/index.js", "description": "IDE 级 Git 操作面板:分支树 + 提交图谱 + 变更/暂存/提交 + 提交详情。装了 dsh-better-sidebar 时挂成它的原生 tab(右侧栏 + 底部工作台);没装时直接挂 DSH 原生右侧栏,单独安装即可用。JetBrains 风格 Git 工具窗口 for DeepSeek Harness.", "engines": { diff --git a/package.json b/package.json index 0f8e368..c52659f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dsh-ide-git", - "version": "0.26.1", + "version": "0.26.2", "description": "DSH plugin: an IDE-grade Git tool window as a native dsh-better-sidebar tab — branch tree, commit graph, changes, commit details, JetBrains-style actions, in the right sidebar and the bottom panel. | DSH 插件:IDE 级 Git 工具窗口,以 dsh-better-sidebar 原生 Tab 挂载——分支树 / 提交图谱 / 变更与提交详情 / JetBrains 风格操作,右侧栏与底部面板双布局自适应。", "type": "module", "repository": { diff --git a/src/client.js b/src/client.js index e236fb0..ec3ad2e 100644 --- a/src/client.js +++ b/src/client.js @@ -16073,6 +16073,11 @@ window.__ModuleLoader__.load({ '.dig-folder-head:hover{color:var(--dsw-alias-label-primary)}', '.dig-folder-name{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}', '.dig-count{margin-left:auto;opacity:.6;font-weight:400}', + /* v0.26.2: the changes head is the one count that belongs to the WORD, not + to the right edge — .dig-count pushes itself to the far right (fine for the + branch groups), so the changes header opts back in to sitting right after + its title (user report: the number floated in the middle of the row). */ + '.dig-changes-head .dig-count{margin-left:0}', '.dig-chevron{display:inline-flex;transform:rotate(-90deg);transition:transform .12s ease}', '.dig-chevron-open{transform:rotate(0deg)}', '.dig-row{display:flex;align-items:center;gap:5px;padding:2px 8px;cursor:pointer;white-space:nowrap;overflow:hidden}', diff --git a/tests/smoke.mjs b/tests/smoke.mjs index 9f22410..7427c88 100644 --- a/tests/smoke.mjs +++ b/tests/smoke.mjs @@ -1214,6 +1214,20 @@ test('a divider only exists when it can move something', () => { assert.equal(wide.overrides.diff, 200, 'a columns diff ratio converts against the body height') }) +test('the changes header keeps its count right after the title (v0.26.2)', () => { + // User report: the number after "变更" floated in the middle of the header row. + // `.dig-count` pins itself to the right edge (that is right for the branch / + // folder groups), so the changes head opts back out of that for its own badge. + assert.match(client, /'\.dig-count\{margin-left:auto;opacity:\.6;font-weight:400\}'/, + 'the shared badge still right-aligns in the group rows') + assert.match(client, /'\.dig-changes-head \.dig-count\{margin-left:0\}'/, + 'the changes header pulls its own count back beside the title') + const head = client.slice(client.indexOf("const head = props.hideHeader === true ? null : E('div', { className: 'dig-section-head dig-changes-head' }"), + client.indexOf("const head = props.hideHeader === true ? null : E('div', { className: 'dig-section-head dig-changes-head' }") + 700) + assert.match(head, /E\('span', \{ className: 'dig-count' \}, String\(total\)\)/, + 'and the header badge is the changes total it sits beside') +}) + test('a rail switch writes exactly its own field, and a refused write rolls back', () => { // task-30. Three shapes are locked here because each one produced a switch // that lied about the Host's document: From 5f4406a4c5c299fe1614f0aac4bf8a073cd4b6ce Mon Sep 17 00:00:00 2001 From: wwei-gtihub <418047394@qq.com> Date: Wed, 4 Nov 2026 15:30:43 +0800 Subject: [PATCH 6/6] =?UTF-8?q?fix(v0.26.3):=20=E5=AE=A1=E6=9F=A5=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E2=80=94=E2=80=94=E9=87=8D=E5=A4=8D=20diff=20?= =?UTF-8?q?=E8=AF=B7=E6=B1=82=E4=B8=8E=E9=A1=B5=E7=AD=BE=E5=8D=B8=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - openDiff 加请求序号(只有最新一次能写 patch/error/patchLoading),并用 diffLast 400ms 窗口吞掉双击产生的连发;双击不再把慢响应画到新文件标题下。 - 纵向布局的两个页签改成常驻窗格(.dig-tab-pane / -hidden),切差异不再卸载历史列表与提交详情,滚动位置保住。 - 未跟踪文件点开空白是 v0.13.x 起的老问题,不在本轮回归范围内,未改(CHANGELOG 里记为已知问题)。 验证:npm test 127/127。 --- CHANGELOG.md | 10 ++++++++++ dsh.plugin.json | 2 +- package.json | 2 +- src/client.js | 39 ++++++++++++++++++++++++++++++++++++--- tests/smoke.mjs | 24 +++++++++++++++++++++++- 5 files changed, 71 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9931643..bfd7b2f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,16 @@ > 倒序排列,新版本条目在最上面。条目格式:`## vX.Y.Z — YYYY-MM-DD` + 类型(feat / fix / docs / chore)+ 要点 + 相关链接。 > 纪律见 AGENTS.md「变更记录纪律」:发版前先更新本文件并随版本提交。 +## v0.26.3 — 2026-11-04 + +**类型**:fix(代码审查 v0.25.0–v0.26.2:重复 diff 请求与页签卸载) + +- **重复请求与竞态**:v0.25.1 让变更行的单击就打开 diff,但行上仍绑着 `onDoubleClick` → 一次双击发三次 `diff` 请求,而 `openDiff` 没有请求序号:`setPatch(data.patch)` 谁最后回来算谁,慢响应会把 文件 A 的 patch 画到 文件 B 的标题下。现在 `openDiff` 记 `diffSeq` 序号,只有最新一次请求能写 `patch` / `error` / `patchLoading`;另加 `diffLast`(key + 时间戳,400ms 窗口)吞掉双击/连点产生的连发。 +- **页签切换会卸载历史列表**:v0.26.0/0.26.1 的页签窗是「三元式换元素」,切到差异就把 `historyPane`(以及 `CommitDetail`)从树上摘掉 → 滚动位置、虚拟列表窗口、详情展开状态全丢。现在两种纵向布局都渲染两个常驻窗格(`.dig-tab-pane`),非激活的那个只加 `.dig-tab-pane-hidden`(`display:none`);Chromium 实测 `display:none` 来回切换后 `scrollTop` 保留(300 → 0(读) → 300)。隐藏的 diff 高 0,被 `measurePanes` 的 `live > 0` 过滤,几何不受污染。 +- **未跟踪文件点开是空白(已知问题,本轮未改)**:`showDiff` 构造宿主 payload 时没带 `untracked`,未跟踪文件会走普通 `git diff -- `(无索引条目 → 空 patch),差异页签置灰;宿主 `diff` 对 `untracked: true` 有 `--no-index /dev/null ` 分支。这是 v0.13.x 起就有的问题,不属于本轮的回归,按指示不动。 +- **验证**:`npm test` 127/127(新增 1 条 v0.26.3 测试:序号守卫 ×2、双击去重;既有的页签断言改到常驻窗格的新形状);`node --check` 通过;`/tmp/scroll-probe.mjs`(headless_shell + 裸 CDP)确认隐藏窗格保滚动。 +- 审查未改的小瑕疵:页签条只有 `data-active`,没有 `role="tablist"` / `aria-selected`;diff 失败后没有重试入口;`paneGeometry` 在分支树折叠时仍按 2 条分隔条扣高度(v0.24 之前就有)。 + ## v0.26.2 — 2026-11-04 **类型**:fix(变更头的数字回到「变更」字样后面) diff --git a/dsh.plugin.json b/dsh.plugin.json index 9b0d767..09e53f0 100644 --- a/dsh.plugin.json +++ b/dsh.plugin.json @@ -1,6 +1,6 @@ { "id": "dsh-external/dsh-ide-git", - "version": "0.26.2", + "version": "0.26.3", "main": "./src/index.js", "description": "IDE 级 Git 操作面板:分支树 + 提交图谱 + 变更/暂存/提交 + 提交详情。装了 dsh-better-sidebar 时挂成它的原生 tab(右侧栏 + 底部工作台);没装时直接挂 DSH 原生右侧栏,单独安装即可用。JetBrains 风格 Git 工具窗口 for DeepSeek Harness.", "engines": { diff --git a/package.json b/package.json index c52659f..055b567 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dsh-ide-git", - "version": "0.26.2", + "version": "0.26.3", "description": "DSH plugin: an IDE-grade Git tool window as a native dsh-better-sidebar tab — branch tree, commit graph, changes, commit details, JetBrains-style actions, in the right sidebar and the bottom panel. | DSH 插件:IDE 级 Git 工具窗口,以 dsh-better-sidebar 原生 Tab 挂载——分支树 / 提交图谱 / 变更与提交详情 / JetBrains 风格操作,右侧栏与底部面板双布局自适应。", "type": "module", "repository": { diff --git a/src/client.js b/src/client.js index ec3ad2e..7094427 100644 --- a/src/client.js +++ b/src/client.js @@ -13178,6 +13178,14 @@ window.__ModuleLoader__.load({ useEffect(() => { if (splitTab === 'diff' && patch === '' && patchLoading === false) setSplitTab('history') }, [splitTab, patch, patchLoading]) + /* v0.26.3: the row fires onDiff from its single click now, so a double + click used to open the same diff three times — and the responses raced + (a slow first request could land after the second and paint the wrong + file under the new title). `diffSeq` stamps each request and only the + newest one is allowed to write; `diffLast` swallows the burst a double + click produces. */ + const diffSeq = useRef(0) + const diffLast = useRef({ key: '', at: 0 }) /* What the open diff pane shows (v0.13.5): the pane is shared by the commit detail (hash + subject) and the working tree (staged or not), and the selection menu's payload must say which. Cleared everywhere @@ -13862,16 +13870,24 @@ window.__ModuleLoader__.load({ }, [sessionId, repoRoot, pickRepo, refresh]) const openDiff = useCallback(async (seed) => { + const key = JSON.stringify([base, seed]) + const now = Date.now() + if (key === diffLast.current.key && now - diffLast.current.at < 400) return + diffLast.current = { key: key, at: now } + const run = diffSeq.current + 1 + diffSeq.current = run setPatchLoading(true) setPatch('') try { const data = await request('diff', Object.assign({}, base, seed)) + if (diffSeq.current !== run) return setPatch(data.patch) } catch (caught) { + if (diffSeq.current !== run) return setErrorCode(null) setError(caught instanceof Error ? caught.message : String(caught)) } finally { - setPatchLoading(false) + if (diffSeq.current === run) setPatchLoading(false) } }, [base]) @@ -15439,6 +15455,16 @@ window.__ModuleLoader__.load({ onClick: () => foldTree(!treeOpen), }, E(Icon, { name: treeOpen ? 'eye' : 'eyeOff' })) : null) + /* v0.26.3: a tabbed window keeps BOTH panes mounted and only hides the + inactive one. Swapping the elements out unmounted the history list (and + the commit detail) on every diff switch, which threw away its scroll + position and the windowed list's state. `display:none` keeps the + scrollTop (verified in Chromium). The hidden diff measures 0 tall and + is dropped by measurePanes' `live > 0` filter, so pane geometry stays + honest. */ + const diffActive = splitTab === 'diff' && fillDiff !== null + const tabPane = (active, node) => node === null ? null : E('div', { className: 'dig-tab-pane' + (active === true ? '' : ' dig-tab-pane-hidden') }, node) + let body if (repoState === null) { /* The scan is still running: a neutral loading state, never the @@ -15473,7 +15499,8 @@ window.__ModuleLoader__.load({ gutter('changes', 'prev'), E('div', { className: 'dig-pane dig-pane-main' }, splitTabs(true, true), - splitTab === 'diff' && fillDiff !== null ? fillDiff : historyPane)) + tabPane(diffActive === false, historyPane), + fillDiff === null ? null : tabPane(diffActive, fillDiff))) } else if (columns) { body = E('div', { className: 'dig-body dig-body-columns', ref: bodyRef }, treeOpen ? E('div', { className: 'dig-pane dig-pane-tree', 'data-pane': 'tree', style: paneStyle('tree') }, E(BranchTree, { t: t, branches: branches, favorites: favorites, onCheckout: checkout, onBrowse: browseBranch, onBranchMenu: branchMenu, onDeleteEntries: deleteBranchEntries, onCopyValues: copyValues, onPicksChange: onBranchPicks, clearSignal: pickEpochs.tree })) : null, @@ -15492,7 +15519,8 @@ window.__ModuleLoader__.load({ and leaves the list (and its scroll position) alone. */ E('div', { className: 'dig-pane dig-pane-main' }, splitTabs(false, false), - splitTab === 'diff' && fillDiff !== null ? fillDiff : historyPane)) + tabPane(diffActive === false, historyPane), + fillDiff === null ? null : tabPane(diffActive, fillDiff))) } /* ---------- overlays ---------- */ @@ -16012,6 +16040,11 @@ window.__ModuleLoader__.load({ window; the strip is the window's tab bar (the compact chrome also hosts the changes count and the tree toggle in it). */ '.dig-split-tabs{display:flex;align-items:center;gap:4px;padding:4px 6px;flex:none;border-bottom:1px solid var(--dsw-alias-border-l2)}', + /* v0.26.3: the tabbed window's bodies stay mounted; the inactive one is + hidden so the history list keeps its scroll position and the detail + keeps its expanded state. */ + '.dig-tab-pane{display:flex;flex-direction:column;flex:1;min-height:0;min-width:0}', + '.dig-tab-pane-hidden{display:none}', '.dig-compact-count{color:var(--dsw-alias-label-secondary);font-weight:500;font-size:11px;padding:0 2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:45%}', '.dig-tab{border:none;background:transparent;color:var(--dsw-alias-label-secondary);font:inherit;font-size:11px;font-weight:500;padding:2px 10px;border-radius:var(--dsw-radius-sm,8px);cursor:pointer;white-space:nowrap;flex:none}', '.dig-tab:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}', diff --git a/tests/smoke.mjs b/tests/smoke.mjs index 7427c88..7aa6771 100644 --- a/tests/smoke.mjs +++ b/tests/smoke.mjs @@ -2112,8 +2112,16 @@ test('clicking a changed file shows its diff in every chrome (v0.25.1)', () => { 'a plain click on a changed file opens its diff') assert.match(client, /'dig-diff-pane' \+ \(fill === true \? ' dig-diff-pane-fill' : ''\)/, 'the compact chrome can render a filling diff pane') - assert.match(client, /splitTab === 'diff' && fillDiff !== null \? fillDiff : historyPane/, + assert.match(client, /const diffActive = splitTab === 'diff' && fillDiff !== null/, 'the compact diff is a tab beside the history window (v0.26.0)') + // v0.26.3: switching tabs must not unmount the history list — it used to lose + // its scroll position and the commit detail its expanded state. + assert.match(client, /const tabPane = \(active, node\) => node === null \? null : E\('div', \{ className: 'dig-tab-pane' \+ \(active === true \? '' : ' dig-tab-pane-hidden'\) \}, node\)/, + 'both tab bodies stay mounted, the inactive one just hides') + assert.match(client, /'\.dig-tab-pane\{display:flex;flex-direction:column;flex:1;min-height:0;min-width:0\}'/, + 'the pane wrapper fills the tab window') + assert.match(client, /'\.dig-tab-pane-hidden\{display:none\}'/, + 'and the hidden pane keeps its scrollTop') assert.match(client, /'data-action': 'diff-tab'/, 'the compact chrome has a diff tab') assert.match(client, /'data-action': 'history-tab'/, 'and a history tab next to it') assert.match(client, /E\('div', \{ className: 'dig-pane dig-pane-changes-stack', 'data-pane': 'changes', style: paneStyle\('changes'\) \}, changesPane\)/, @@ -2134,3 +2142,17 @@ test('clicking a changed file shows its diff in every chrome (v0.25.1)', () => { assert.match(client, /setSelectedPath\(seed\.path === undefined \? null : seed\.path\)/, 'the inline diff header names the file it shows') }) + +test('the diff request is single-flight, and untracked files keep their patch (v0.26.3)', () => { + // v0.25.1 made the row's single click open the diff, but the row still had + // onDoubleClick wired to the same handler: a double click fired three + // requests and the responses raced (an older patch could land last and paint + // the wrong file under the new title). + assert.match(client, /const diffSeq = useRef\(0\)/, 'each diff request gets a stamp') + assert.match(client, /if \(key === diffLast\.current\.key && now - diffLast\.current\.at < 400\) return/, + 'the burst a double click produces is deduped') + assert.equal((client.match(/if \(diffSeq\.current !== run\) return/g) || []).length, 2, + 'a stale response may not write the patch nor the error') + assert.match(client, /if \(diffSeq\.current === run\) setPatchLoading\(false\)/, + 'and only the newest request clears the spinner') +})