feat(gpui): tab rename, color label, and single-tab export

三项标签元数据功能补齐旧壳能力边界:

• **F2 重命名**:侧栏行内编辑,Enter 提交 / Esc 取消 / 失焦提交。
  空串 = 恢复自动标签名(取 cwd 末段或文件名)。custom_name 与
  session v4 同字段,导出/恢复直通不需转换层。

• **标签颜色**:右键菜单尾部色板(首槽 A = 无色 + 7 枚品牌色,同色
  再点取消,当前色带选中环)。左侧栏行首画一条竖光条(4px 内缩、
  上下各留 7px、宽 2.5px + 圆角),默认标签不占视觉层级。旧壳
  context_menu::TAB_COLORS 原地复用(已设色的 tab 可迁移过来)。

• **导出单标签为工作区**:文件名取标签名,扩展名 .nebula-workspace.json,
  落盘走共享 v4 schema。只导出可恢复的终端标签(图片/文档/设置页
  从不进 session)。

**结构性约束**:tabs 与 tab_meta 必须同下标(长度一致),所有增删移
操作封口到 insert_tab_at / remove_tab_at / move_tab 三个 helper,
避免本地分叉时色条和名字错位到邻居身上。恢复期保留文件里的既有次序,
不套「新标签插入位置」策略;快照时从 meta 拿 custom_name/color。

右键菜单新增「导出为工作区…」「重命名」条目,action 字段只用来渲染
键帽(handler 存在时组件不会 dispatch 它),命令仍然作用在被右键的
那个 tab 上,而不是活动标签。菜单结构、分隔符与键帽对齐旧壳
display::context_menu 的 Tab 目标。

依赖 gpui-component 1b737db8(popover_shadow helper + Theme::shadow
门控),已推送 Kuddev/gpui-component nebula 分支并更新 Cargo.toml。
This commit is contained in:
kuddev committed 2026-08-15 21:07:19 +08:00
1 parent ad869bb3ea
commit dd76e797f6
4 files changed
+4032 -3564

No files matched your search

Generated
+3 -3
View File
@@ -3090,7 +3090,7 @@ dependencies = [
[[package]]
name = "gpui-component"
version = "0.5.1"
source = "git+https://github.com/Kuddev/gpui-component?rev=0f0ab35233212f8f3277028995caf0c41e13ee6c#0f0ab35233212f8f3277028995caf0c41e13ee6c"
source = "git+https://github.com/Kuddev/gpui-component?rev=1b737db8f172d4d4fe1113fbde4d8bb09a4c6afe#1b737db8f172d4d4fe1113fbde4d8bb09a4c6afe"
dependencies = [
"aho-corasick",
"anyhow",
@@ -3129,7 +3129,7 @@ dependencies = [
[[package]]
name = "gpui-component-assets"
version = "0.5.1"
source = "git+https://github.com/Kuddev/gpui-component?rev=0f0ab35233212f8f3277028995caf0c41e13ee6c#0f0ab35233212f8f3277028995caf0c41e13ee6c"
source = "git+https://github.com/Kuddev/gpui-component?rev=1b737db8f172d4d4fe1113fbde4d8bb09a4c6afe#1b737db8f172d4d4fe1113fbde4d8bb09a4c6afe"
dependencies = [
"anyhow",
"gpui",
@@ -3139,7 +3139,7 @@ dependencies = [
[[package]]
name = "gpui-component-macros"
version = "0.5.1"
source = "git+https://github.com/Kuddev/gpui-component?rev=0f0ab35233212f8f3277028995caf0c41e13ee6c#0f0ab35233212f8f3277028995caf0c41e13ee6c"
source = "git+https://github.com/Kuddev/gpui-component?rev=1b737db8f172d4d4fe1113fbde4d8bb09a4c6afe#1b737db8f172d4d4fe1113fbde4d8bb09a4c6afe"
dependencies = [
"proc-macro2",
"quote",
+13 -5
View File
@@ -71,9 +71,17 @@ winit = { path = "third_party/winit-0.30.13" }
# (= zed-industries/zed 发布 gpui 0.2.2 的 rev,
# crates/gpui;上游发布时 dirty=true,若首次编译出现
# 与 registry src 的差异以 diff 为准补一个对齐 commit)
# Kuddev/gpui-component nebula @ 0f0ab35233212f8f3277028995caf0c41e13ee6c
# (= longbridge/gpui-component v0.5.1,crates/ui;
# 上级目录 gpui-component-v0.5.1/ 有源码检出可对照)
# Kuddev/gpui-component nebula @ 1b737db8f172d4d4fe1113fbde4d8bb09a4c6afe
# (基点 0f0ab352 = longbridge/gpui-component v0.5.1,
# crates/ui;上级目录 gpui-component-v0.5.1/ 有源码
# 检出可对照)
# 补丁栈:
# 1b737db8 popover 阴影:Tailwind shadow-lg(0 10 15
# -3 + 0 4 6 -4,两层 10% 黑)在半透明/亚克力窗口下
# 没有不透明底稀释,读起来是"菜单下垫了一块黑板"。
# 换成单层短偏移 + 负扩散,并尊重 Theme::shadow
# (button/input/slider 本来就这么门控)。无 upstream
# PR:数值是对着半透明宿主窗口调的。
#
# 加补丁 = 提交到 fork 的 nebula 分支 → push → 更新下面的 rev(永远 pin
# exact rev、不 pin branch)。每个补丁注明原因 + upstream PR 链接,上游合并
@@ -92,5 +100,5 @@ winit = { path = "third_party/winit-0.30.13" }
# shaper 遇换行 panic;替换保 byte 长度,run 偏移不失效)
# 本地 fork 工作拷贝在 ../gpui-component-fork(已挂 tty7 remote 可 diff)。
gpui = { git = "https://github.com/Kuddev/zed", rev = "69e2130295c2649963eb639fc70b4f2ee8ea1624" }
gpui-component = { git = "https://github.com/Kuddev/gpui-component", rev = "0f0ab35233212f8f3277028995caf0c41e13ee6c" }
gpui-component-assets = { git = "https://github.com/Kuddev/gpui-component", rev = "0f0ab35233212f8f3277028995caf0c41e13ee6c" }
gpui-component = { git = "https://github.com/Kuddev/gpui-component", rev = "1b737db8f172d4d4fe1113fbde4d8bb09a4c6afe" }
gpui-component-assets = { git = "https://github.com/Kuddev/gpui-component", rev = "1b737db8f172d4d4fe1113fbde4d8bb09a4c6afe" }
+5 -5
View File
@@ -75,7 +75,7 @@ pub mod window;
mod chrome;
pub mod command_palette;
mod context_menu;
pub(crate) mod context_menu;
mod i18n;
pub mod markdown_view;
mod message_queue_entry;
@@ -96,11 +96,11 @@ pub(crate) fn quick_terminal_hotkey_from_settings(config: &UiConfig) -> String {
}
pub(crate) use chrome::chrome_settings_button_rect;
// GPUI 壳的侧栏共用同一套「按列截断 + 省略号」规则:省略号是合同的一部分,
// 两个壳各写一份必然漂移(GPUI 曾靠字符数上限截断,末尾直接吃掉)。
pub(crate) use chrome::truncate_tab_label;
pub use chrome::{ChromeHit, TabDropAction, in_chrome_bar, resize_edge};
use chrome::{
ChromeTabLayout, TabDrag, chrome_hit_with_tabs, chrome_tab_layout, contains_rect,
truncate_tab_label,
};
use chrome::{ChromeTabLayout, TabDrag, chrome_hit_with_tabs, chrome_tab_layout, contains_rect};
pub use context_menu::{ContextMenuAction, ContextMenuHit, ContextMenuTarget};
pub use i18n::{LanguagePreference, UiLanguage};
pub use size_info::SizeInfo;
File diff suppressed because it is too large. Load diff