feat(tab-bar): 终端 Tab 支持双击内联重命名 - #209
Open
LiarCoder wants to merge 8 commits into
Open
Conversation
双击终端 Tab 标签进入内联编辑(自动聚焦全选),Enter/失焦提交、 Esc 取消、空文本不提交;输入期间不重置选区(IME 安全)。重命名经 patchTab 随会话布局持久化。仅终端 Tab 可重命名(编辑器标签跟随 文件路径、浏览器标签跟随页面标题)。附 vitest+jsdom 回归测试。
havoc-rao
pushed a commit
to havoc-rao/DSH-better-sidebar
that referenced
this pull request
Aug 20, 2026
Merge terminal-tab inline rename from omdsh-dev#209 (authored by LiarCoder) into this fork's modernized tab strip: - Double-click a terminal tab's label to rename it inline (Enter/blur commits, Esc cancels, IME-aware); the new name persists with the layout. - Grafted onto the fork's refactored tab strip (renderTabEl + workspace-bound pinned stubs) and the VSCode/Side-Bar layout: wired canRenameTab/onRename through the Workbench -> NodeView -> LeafView -> TabBar chain in both the right and bottom panel workbenches. - Adds tests/tabbar-rename.spec.tsx and the renameTab/renameTabHint i18n keys. Conflicts in Sidebar.tsx / TabBar.tsx / split-pane.tsx resolved by keeping both the fork's workspace-window + VSCode-layout changes and the PR's rename feature.
LiarCoder
force-pushed
the
feat/tab-rename
branch
from
August 21, 2026 12:09
0cf54ac to
dadcbce
Compare
LiarCoder
force-pushed
the
feat/tab-rename
branch
from
August 21, 2026 12:12
dadcbce to
e7aaf6b
Compare
LiarCoder
force-pushed
the
feat/tab-rename
branch
from
August 27, 2026 12:39
1e3cfa4 to
32c7c80
Compare
LiarCoder
force-pushed
the
feat/tab-rename
branch
from
August 27, 2026 15:59
47f9bf2 to
60d9bc4
Compare
…aderDesc i18n 全语言同步),解决 20 个语言文件冲突(双方 key 都保留)
…ev#541),解决 Sidebar.tsx 冲突(保留 patchTab 等 4 个仍在用的符号)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
feat(tab-bar): 终端 Tab 支持双击内联重命名
背景
侧边栏的终端 Tab 创建后只能显示自动编号(「终端 1」「终端 2」…),没有任何改名的入口。在右侧栏 + 底部面板双工作台、分栏拆分的场景下开多个终端时,只能靠编号区分用途——「这个是 dev server、那个连的是生产环境」这类信息没法写进标签。状态层其实早有
patchTab(state, tabId, { title })reducer(浏览器 Tab 就用它持久化当前页面标题),缺的只是 tab 栏的重命名 UI 与接线。实现效果
patchTab持久化到会话布局,刷新 / 切换会话后保留;实现
TabBar.tsx:新增canRenameTab/onRenameprops;双击标签进入编辑,渲染内联<input>(useCallback稳定 ref,只在挂载时 focus + select);split-pane.tsx:WorkbenchActions新增renameTab,canRenameTab沿 Workbench → NodeView → LeafView 透传;Sidebar.tsx:renameTab走store.reduce(s => patchTab(s, tabId, { title }));canRenameTab限定tab.type === 'terminal';locales.ts:新增renameTab/renameTabHint(zh / en);sidebar.module.css:新增.tabRename输入框样式(--dsw-alias-*令牌驱动,跟随皮肤);tests/tabbar-rename.spec.tsx:vitest + jsdom 回归测试(4 例)——逐字符输入累积且不重置选区、Enter 提交且不重复触发、Esc 取消 / 失焦提交、IME 组词 Enter 忽略。验证
tsc --noEmit✅pnpm build(tsc 声明 + tsdown 全部产物)✅vitest run:613 passed / 8 failed / 3 skipped——8 个失败与本次改动无关,已 stash 改动后在纯净 main 上对比验证同样复现(本机 Windows 环境的既有问题)