Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ replace github.com/vivaui/viva => github.com/Lithe-IDEA/viva <fork commit 的伪
- 删掉的绕过代码,以及改用的新写法;还留着的绕过代码,以及原因。
- 验证:运行了哪些命令、在哪些平台上、结果如何。没有跑的检查也要写明原因。

### 列表身份兼容检查

升级含行标识检查的 Viva 时,检查所有 `ListState.Key` 和 `TreeState.Key`:包括不可选择的加载页脚也必须返回 0 至 2^31−1 的唯一标识。不能用负数表达“不能选择”,也不能对摘要做截断来代替唯一编号。Git 历史视图保留 0 给加载页脚、提交从 1 编号,提交重排时复用原编号;是否允许选择仍由原来的交互逻辑决定。新建项目侧栏为两个标题固定保留 0/1,条目从 2 开始,过滤隐藏分组不改编号;Git 控制台也为刷新时暂缺的行保留 0,真实行从 1 编号。此处是 Viva 呈现身份,留在视图,不改变 Core 的提交模型。回归 `TestLogCommitKeysKeepFooterInRangeAndSeparate` 覆盖范围、唯一性和重排稳定性。

### 需要 Viva 命令行工具的脚本

- 从 `desktop/go.mod` 解析出的源码目录构建:先 `go -C desktop mod download github.com/vivaui/viva`,再用 `go -C desktop list -m -f '{{.Dir}}' github.com/vivaui/viva` 得到目录,然后 `go -C <目录> build ./cmd/viva`。这样会遵守 `replace`,并用 Viva 自己的 `go.mod` 和 `go.sum`,不依赖桌面模块的 `go.sum`。
Expand Down
4 changes: 2 additions & 2 deletions desktop/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ toolchain go1.27.3
require (
github.com/creack/pty v1.1.24
github.com/tailscale/hujson v0.0.0-20260727124030-b80ff77dac4f
github.com/vivaui/viva v0.6.5-0.20261115063318-1fc84f6ff1d3
github.com/vivaui/viva v0.6.5-0.20261115084025-ad3c812a43e2
github.com/zalando/go-keyring v0.2.8
golang.org/x/sys v0.50.0
)
Expand All @@ -20,4 +20,4 @@ require (
github.com/godbus/dbus/v5 v5.2.2 // indirect
)

replace github.com/vivaui/viva => github.com/Lithe-IDEA/viva v0.6.5-0.20261115102023-09fe3cda594e
replace github.com/vivaui/viva => github.com/Lithe-IDEA/viva v0.6.5-0.20261115111929-3a274c3800ef
4 changes: 2 additions & 2 deletions desktop/go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
github.com/Lithe-IDEA/viva v0.6.5-0.20261115102023-09fe3cda594e h1:xCv+33OR4v+x8NuWgodE/5BNvxf56+Y2e+NAexuZPVQ=
github.com/Lithe-IDEA/viva v0.6.5-0.20261115102023-09fe3cda594e/go.mod h1:e9In6+J77G7B9ow4enZ2FSOFh7U3q4cQ5iJr3Qn/Olk=
github.com/Lithe-IDEA/viva v0.6.5-0.20261115111929-3a274c3800ef h1:p3n2Bsu2/gCcNmbVBJ5eu6NEW8JjUX7zf/uzgFAA9Mc=
github.com/Lithe-IDEA/viva v0.6.5-0.20261115111929-3a274c3800ef/go.mod h1:e9In6+J77G7B9ow4enZ2FSOFh7U3q4cQ5iJr3Qn/Olk=
github.com/creack/pty v1.1.24 h1:bJrF4RRfyJnbTJqzRLHzcGaZK1NeM5kTC9jGgovnR1s=
github.com/creack/pty v1.1.24/go.mod h1:08sCNb52WyoAwi2QDyzUCTgcvVFhUzewun7wtTfvcwE=
github.com/danieljoos/wincred v1.2.3 h1:v7dZC2x32Ut3nEfRH+vhoZGvN72+dQ/snVXo/vMFLdQ=
Expand Down
20 changes: 20 additions & 0 deletions desktop/internal/workbench/git_history_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,23 @@ func TestLogCommitMenuOffersUndoAndSquashOnlyAsCoreHints(t *testing.T) {
}
}
}

// A loading footer participates in List's row identities even though it is not
// a selectable commit. Its key must be valid and distinct from every commit.
func TestLogCommitKeysKeepFooterInRangeAndSeparate(t *testing.T) {
v := logView{keyRows: []core.GraphRow{{CommitHash: "first"}, {CommitHash: "second"}}}
first, second := v.logCommitKey(0), v.logCommitKey(1)
footer := v.logCommitKey(len(v.keyRows))
for _, key := range []int{first, second, footer} {
if key < 0 || uint64(key) >= 1<<31 {
t.Fatalf("row key %d is outside Viva's supported range", key)
}
}
if first == second || first == footer || second == footer {
t.Fatalf("commit and footer keys collide: %d %d %d", first, second, footer)
}
v.keyRows[0], v.keyRows[1] = v.keyRows[1], v.keyRows[0]
if v.logCommitKey(0) != second || v.logCommitKey(1) != first || v.logCommitKey(len(v.keyRows)) != footer {
t.Fatal("commit identities or the loading footer changed after reordering")
}
}
6 changes: 3 additions & 3 deletions desktop/internal/workbench/gitconsole.go
Original file line number Diff line number Diff line change
Expand Up @@ -367,10 +367,10 @@ func consoleSearchText(text string) string {
}

// rowKey is the list key of row i. The list may ask for a row the rows no longer have while
// it settles, which gets a key no row has.
// it settles, which gets zero, an identity reserved for a missing row.
func (v *consoleView) rowKey(i int) int {
if i < 0 || i >= len(v.rows) {
return -1 - i
return 0
}
return v.rows[i].key
}
Expand All @@ -388,7 +388,7 @@ func (v *consoleView) rowLabel(i int) string {
func (v *consoleView) add(old map[consoleRowID]int, row consoleRow) int {
key, ok := old[row.id]
if _, taken := v.keys[row.id]; !ok || taken {
key = v.nextKey
key = v.nextKey + 1 // Zero belongs to a missing row while the list settles.
v.nextKey++
}
row.key = key
Expand Down
9 changes: 9 additions & 0 deletions desktop/internal/workbench/gitconsole_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -585,3 +585,12 @@ func TestConsoleDrawsTheProjectedCommandBeforeItIsPresented(t *testing.T) {
t.Fatalf("consoleDrawnHeader() without a projection = %q, want the raw header %q", got, want)
}
}

func TestConsoleRowKeysReserveValidMissingRowIdentity(t *testing.T) {
v := consoleView{keys: map[consoleRowID]int{}}
v.add(nil, consoleRow{})
missing := v.rowKey(len(v.rows))
if missing < 0 || uint64(missing) >= 1<<31 || missing == v.rowKey(0) {
t.Fatalf("missing row key %d is invalid or collides with the first row %d", missing, v.rowKey(0))
}
}
7 changes: 4 additions & 3 deletions desktop/internal/workbench/gitlog_view.go
Original file line number Diff line number Diff line change
Expand Up @@ -605,10 +605,11 @@ func (a *App) drawLogFooter(c ui.C, p *project, row ui.ListRow) {
}

// logCommitKey is the key of row i of the commit list in its selection: the key of the commit's
// hash, so a choice survives a reload that moves the rows. The row past the commits has none.
// hash, so a choice survives a reload that moves the rows. Zero identifies the
// loading footer, which still needs a valid identity even though it is not selectable.
func (v *logView) logCommitKey(i int) int {
if i < 0 || i >= len(v.keyRows) {
return -1
return 0
}
return v.hashKey(v.keyRows[i].CommitHash)
}
Expand All @@ -623,7 +624,7 @@ func (v *logView) hashKey(hash string) int {
if v.keys == nil {
v.keys = map[string]int{}
}
k := len(v.keys)
k := len(v.keys) + 1 // Zero belongs to the loading footer.
v.keys[hash] = k
return k
}
22 changes: 22 additions & 0 deletions desktop/internal/workbench/new_project_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -981,3 +981,25 @@ func TestNewProjectToolFieldListsInstallationsAndPinsTheChoice(t *testing.T) {
t.Fatalf("the project's tool pin = %q, %v", pin, err)
}
}

func TestNewProjectSidebarKeysStayValidAcrossFiltering(t *testing.T) {
n := newProjectState{choices: []projectChoice{
{key: "empty", name: "Empty", section: "project"},
{key: "template", name: "Template", section: "generator"},
}}
before := map[string]int{}
seen := map[int]bool{}
for _, row := range n.sidebarRows(i18n.English) {
if row.id < 0 || uint64(row.id) >= 1<<31 || seen[row.id] {
t.Fatalf("invalid or duplicate sidebar identity %d", row.id)
}
seen[row.id] = true
before[row.title] = row.id
}
n.visible = map[string]bool{"template": true}
for _, row := range n.sidebarRows(i18n.English) {
if row.id != before[row.title] {
t.Fatalf("filtering changed %q identity", row.title)
}
}
}
7 changes: 4 additions & 3 deletions desktop/internal/workbench/new_project_view.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,21 @@ type sidebarRow struct {
// sidebarRows lists the entries the search shows, under their section headings.
func (n *newProjectState) sidebarRows(language i18n.Language) []sidebarRow {
var rows []sidebarRow
for _, section := range []string{"project", "generator"} {
for sectionIndex, section := range []string{"project", "generator"} {
start := len(rows)
for index, choice := range n.choices {
if choice.section != section || (n.visible != nil && !n.visible[choice.key]) {
continue
}
rows = append(rows, sidebarRow{title: choice.name, key: choice.key, id: index + 1})
rows = append(rows, sidebarRow{title: choice.name, key: choice.key, id: index + 2})
}
if len(rows) > start {
title := i18n.Shared(language, "desktop.newProject.section")
if section == "generator" {
title = i18n.Shared(language, "desktop.newProject.generators")
}
rows = slices.Insert(rows, start, sidebarRow{header: true, title: title, id: -len(rows) - 1})
// The two headings keep identities 0 and 1 even when filtering hides a group.
rows = slices.Insert(rows, start, sidebarRow{header: true, title: title, id: sectionIndex})
}
}
return rows
Expand Down
8 changes: 5 additions & 3 deletions shared/platform-feature-matrix/features/git-history.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
"desktop/internal/core/git_checkout.go",
"desktop/internal/workbench/app_test.go",
"desktop/internal/i18n/welcome_messages.go",
"desktop/internal/workbench/ui_baseline_test.go"
"desktop/internal/workbench/ui_baseline_test.go",
"desktop/internal/workbench/new_project_view.go",
"desktop/internal/workbench/new_project_test.go"
]
},
"windows": {
Expand All @@ -38,11 +40,13 @@
"desktop/internal/core/git_checkout.go",
"desktop/internal/workbench/app_test.go",
"desktop/internal/i18n/welcome_messages.go",
"desktop/internal/workbench/ui_baseline_test.go"
"desktop/internal/workbench/ui_baseline_test.go",
"desktop/internal/workbench/new_project_view.go",
"desktop/internal/workbench/new_project_test.go"
]
},
"owner": "Onboarding",
"verification": "清空首次启动状态,验证打开项目、克隆项目、最近项目和跳过引导;在 macOS 深色与浅色模式检查欢迎页布局、颜色和交互,内容容器四周保留 8pt 外边距,默认与最小窗口尺寸下按钮文案完整且项目行可操作,确认默认及最小内容尺寸均为 800×650、可向屏幕可用区域放大,左下角齿轮菜单采用设置页下拉框配色并可进入设置与检查更新;最近项目整行(含文字外空白和边缘)悬停时高亮并显示小手光标,移出后恢复默认光标,项目按钮上下空白可点击打开,右侧菜单悬停底框为 22pt、点击范围保留 28pt,菜单独立操作,失效路径不可打开。 macOS 欢迎页 New Project、Open、Clone Repository 三个按钮在明暗主题使用 4pt 圆角、至少 72pt 宽、6pt 按钮间距;默认及最小窗口尺寸下长文案按内容扩展且不显示省略号,搜索区保持 180–220pt,放不下完整操作组时 Clone Repository/Remote Development 收入更多菜单,按钮水平内容留白为 14pt,28pt 高度、文字、边框、悬停与焦点表现保持原有实现,搜索区不应用按钮组间距;顶部保持单行与原高度,窗口最小尺寸不变;搜索区显示原始 16pt IDEA 搜索图标及明暗资源颜色,提示使用共享输入组件的 13pt Regular 和专用提示色;验证中文组合输入、搜索过滤及三个原有动作仍可用。 欢迎页按钮使用共享 LitheActionButtonStyle,悬停配色统一来自 LitheTheme.hoverBackground、页面不单独覆盖,表单保留原有外部留白、主按钮和禁用状态;验证长文字宽度与欢迎页无额外外部按钮留白。 打开一个 Git 项目后返回欢迎页,确认最近项目行在名称和路径下显示上次记录的分支(无需启动 Git 即可出现),非 Git 文件夹不显示分支行;确认行距紧凑、悬停高亮与省略号菜单行为不变。 最近项目分支图标按 Community c7f91397daa3a961b4e78bc634fe467a0a7d9ade 的 RecentProjectFilteringTree.kt → AllIcons.Vcs.Branch → PlatformIconMappings.json → expui/general/vcs.svg 使用原始 16pt 明暗资源及路径失焦文字色,不显示旧列表占位图标或缩为 11pt;深浅主题核对分支、名称、路径和点击动作。 欢迎页最近项目按 Community c7f91397 的 RecentProjectComponent 对齐:20pt 头像顶部对齐且比文字顶部低 2pt,头像到文字 12pt,标题/路径/分支行间距 4pt,分支图文间距 4pt,标题 13pt、路径及分支 12pt;上下各 8pt、左侧 10pt、右侧 8pt 留白,行高随可选分支增加而非固定 56pt。运行 welcomeRowsGrowForBranchesWithoutOverlapping,在深浅主题及 800/1100pt 宽度验证真实欢迎页的两行/三行条目不重叠、横向一致,人工检查打开、禁用和菜单动作。 欢迎页溢出入口为本地化 More/更多文字。克隆仓库表单使用 LitheTextField/LitheFormField,目录选择按钮与输入框并列,外层使用 LitheCenteredPopup 有标题居中面板,移除系统 sheet 与内容自绘标题行;面板无展开动画,高度随表单增长;取消/成功关闭复位呈现状态,克隆期间禁止手动关闭。运行 CloneRepositoryStyleTests 深浅主题验证输入区域不裁剪、13pt 共享字体及 URL 自动建议文件夹名;人工验收目录选择、取消和真实克隆。 macOS 最近项目的 HEAD 与 gitdir 语义由 Core 解析,有界读取与路径解析留在宿主;普通仓库、worktree 与 detached HEAD 有自动测试。",
"verification": "清空首次启动状态,验证打开项目、克隆项目、最近项目和跳过引导;在 macOS 深色与浅色模式检查欢迎页布局、颜色和交互,内容容器四周保留 8pt 外边距,默认与最小窗口尺寸下按钮文案完整且项目行可操作,确认默认及最小内容尺寸均为 800×650、可向屏幕可用区域放大,左下角齿轮菜单采用设置页下拉框配色并可进入设置与检查更新;最近项目整行(含文字外空白和边缘)悬停时高亮并显示小手光标,移出后恢复默认光标,项目按钮上下空白可点击打开,右侧菜单悬停底框为 22pt、点击范围保留 28pt,菜单独立操作,失效路径不可打开。 macOS 欢迎页 New Project、Open、Clone Repository 三个按钮在明暗主题使用 4pt 圆角、至少 72pt 宽、6pt 按钮间距;默认及最小窗口尺寸下长文案按内容扩展且不显示省略号,搜索区保持 180–220pt,放不下完整操作组时 Clone Repository/Remote Development 收入更多菜单,按钮水平内容留白为 14pt,28pt 高度、文字、边框、悬停与焦点表现保持原有实现,搜索区不应用按钮组间距;顶部保持单行与原高度,窗口最小尺寸不变;搜索区显示原始 16pt IDEA 搜索图标及明暗资源颜色,提示使用共享输入组件的 13pt Regular 和专用提示色;验证中文组合输入、搜索过滤及三个原有动作仍可用。 欢迎页按钮使用共享 LitheActionButtonStyle,悬停配色统一来自 LitheTheme.hoverBackground、页面不单独覆盖,表单保留原有外部留白、主按钮和禁用状态;验证长文字宽度与欢迎页无额外外部按钮留白。 打开一个 Git 项目后返回欢迎页,确认最近项目行在名称和路径下显示上次记录的分支(无需启动 Git 即可出现),非 Git 文件夹不显示分支行;确认行距紧凑、悬停高亮与省略号菜单行为不变。 最近项目分支图标按 Community c7f91397daa3a961b4e78bc634fe467a0a7d9ade 的 RecentProjectFilteringTree.kt → AllIcons.Vcs.Branch → PlatformIconMappings.json → expui/general/vcs.svg 使用原始 16pt 明暗资源及路径失焦文字色,不显示旧列表占位图标或缩为 11pt;深浅主题核对分支、名称、路径和点击动作。 欢迎页最近项目按 Community c7f91397 的 RecentProjectComponent 对齐:20pt 头像顶部对齐且比文字顶部低 2pt,头像到文字 12pt,标题/路径/分支行间距 4pt,分支图文间距 4pt,标题 13pt、路径及分支 12pt;上下各 8pt、左侧 10pt、右侧 8pt 留白,行高随可选分支增加而非固定 56pt。运行 welcomeRowsGrowForBranchesWithoutOverlapping,在深浅主题及 800/1100pt 宽度验证真实欢迎页的两行/三行条目不重叠、横向一致,人工检查打开、禁用和菜单动作。 欢迎页溢出入口为本地化 More/更多文字。克隆仓库表单使用 LitheTextField/LitheFormField,目录选择按钮与输入框并列,外层使用 LitheCenteredPopup 有标题居中面板,移除系统 sheet 与内容自绘标题行;面板无展开动画,高度随表单增长;取消/成功关闭复位呈现状态,克隆期间禁止手动关闭。运行 CloneRepositoryStyleTests 深浅主题验证输入区域不裁剪、13pt 共享字体及 URL 自动建议文件夹名;人工验收目录选择、取消和真实克隆。 macOS 最近项目的 HEAD 与 gitdir 语义由 Core 解析,有界读取与路径解析留在宿主;普通仓库、worktree 与 detached HEAD 有自动测试。 Viva 新建项目侧栏:TestNewProjectSidebarKeysStayValidAcrossFiltering 覆盖分组标题和项目行的合法唯一标识,以及筛选隐藏首组后的稳定性;无头新建项目测试覆盖实际列表绘制,原生验收状态仍 pending。",
"legacy": {
"revision": "5a54c41aa37a4e6e6b68918a4b05765b9dd07a36",
"macos": {
Expand Down
Loading