From eeea5265541d09b21eb5bff5f9f460206f108af4 Mon Sep 17 00:00:00 2001 From: lick <2188718831@qq.com> Date: Sat, 21 Nov 2026 05:49:28 -0800 Subject: [PATCH] fix(desktop): open Viva settings and finish interrupted shutdowns --- ...11-21-viva-settings-and-window-shutdown.md | 37 ++++ desktop/Makefile | 2 +- desktop/internal/pluginview/render.go | 2 +- desktop/internal/pluginview/render_test.go | 10 + .../internal/pluginview/view_visual_test.go | 2 + .../internal/settingswindow/stepping_view.go | 10 +- .../settingswindow/visual_capture_test.go | 6 + .../internal/settingswindow/window_view.go | 2 +- .../workbench_background_view.go | 2 +- desktop/internal/workbench/app.go | 188 +++++++++++------- desktop/internal/workbench/editor_recovery.go | 6 +- desktop/internal/workbench/fault_test.go | 68 +++++++ .../internal/workbench/runconfig_form_view.go | 2 +- scripts/desktop/check.sh | 4 +- .../features/window-controls.json | 8 +- .../features/workbench-settings-entry.json | 8 +- 16 files changed, 263 insertions(+), 94 deletions(-) create mode 100644 .agents/notes/implemented/bug-fix/2026-11-21-viva-settings-and-window-shutdown.md diff --git a/.agents/notes/implemented/bug-fix/2026-11-21-viva-settings-and-window-shutdown.md b/.agents/notes/implemented/bug-fix/2026-11-21-viva-settings-and-window-shutdown.md new file mode 100644 index 0000000000..a4ddaec945 --- /dev/null +++ b/.agents/notes/implemented/bug-fix/2026-11-21-viva-settings-and-window-shutdown.md @@ -0,0 +1,37 @@ +# Agent 笔记:Viva 设置属性校验与窗口退出收尾 + +状态:已实现 + +## 先说结论 + +分段控件用各选项声明的名称提供无障碍命中,多行输入与列表行只使用组件支持的属性。窗口循环返回时,工作台直接取消仍然存在的项目并写入恢复草稿。正常关窗时的保存和确认仍在窗口循环内完成。 + +## 问题 + +[#2285](https://github.com/1lck/Lithe-IDEA/issues/2285) 在 dev 构建打开设置时触发 Viva 的属性校验。窗口循环被中断后,旧收尾还发起普通项目关闭,把文件检查结果交给已经停止的 OnWake。语言服务器因此没有收到取消,工作台一直在等它退出。 + +## 决策 + +- 外观、背景强度与通用插件分段控件以选项名称命中。调试器行只在获得 ID 的绘制阶段使用悬停样式,静态容器保持原有命中范围。运行配置多行输入移除框架忽略的等宽属性。 +- 正常关闭经用户确认后进入项目资源释放。窗口循环返回后直接复用资源释放,先取消各项目及其服务器,再等待后台任务。未保存的编辑内容按现有恢复存储规则落盘。 +- 退出等待给插件服务器的停止期限留出余量。超过总期限后记录已有的后台失败事件。恢复草稿写入错误在后台写入点记录,提示仍通过界面队列发送。 + +## 考虑过的备选方案 + +在窗口停止后主动处理 OnWake 队列会再次运行可能打开弹窗、改动关闭后的视图或启动新任务的回调。直接释放项目资源可以将退出限定为取消任务、写恢复草稿及释放资源。 + +## 后果 + +项目取消、恢复写入和进程收尾不需要等待下一帧。若后台工作无法在总期限内结束,日志会记录超时,应用继续退出。 + +## 验证 + +- 在严格 dev 属性校验下运行设置页及合成插件分段控件测试。 +- 用合成语言服务器覆盖普通项目关闭检查尚未回到窗口线程就结束窗口循环的情况,检查服务器取消、恢复草稿写入和原文件未改动。 + +## 适用范围 + +- `desktop/internal/settingswindow/` +- `desktop/internal/pluginview/render.go` +- `desktop/internal/workbench/app.go` +- `desktop/internal/workbench/editor_recovery.go` diff --git a/desktop/Makefile b/desktop/Makefile index c16daf12db..4eda8202e0 100644 --- a/desktop/Makefile +++ b/desktop/Makefile @@ -54,7 +54,7 @@ run dev: build test: $(SCRIPTS)/desktop-go.sh test ./... - $(SCRIPTS)/desktop-go.sh test -tags dev ./internal/buildinfo + $(SCRIPTS)/desktop-go.sh test -tags dev ./internal/buildinfo ./internal/settingswindow ./internal/pluginview ./internal/workbench vet: $(SCRIPTS)/desktop-go.sh vet ./... diff --git a/desktop/internal/pluginview/render.go b/desktop/internal/pluginview/render.go index 186e5ecd7b..fbee46d9ce 100644 --- a/desktop/internal/pluginview/render.go +++ b/desktop/internal/pluginview/render.go @@ -474,7 +474,7 @@ func (r *renderer) choice(c ui.C, n *Node) { // the user made in this paint. func choose[T comparable](c ui.C, n *Node, label string, value *T, values []T, name func(T) string) bool { if n.Type == "segmented" { - return ui.Choice(c, value, values, name).Label(label).Changed() + return ui.Choice(c, value, values, name).Changed() } return ui.Select(c, value, values, name).MinWidth(120).MaxWidth(230).Label(label).Changed() } diff --git a/desktop/internal/pluginview/render_test.go b/desktop/internal/pluginview/render_test.go index 1316ec9523..1a501aedf6 100644 --- a/desktop/internal/pluginview/render_test.go +++ b/desktop/internal/pluginview/render_test.go @@ -143,6 +143,16 @@ func TestDrawSendsChangeForAToggleWithItsValue(t *testing.T) { } } +func TestDrawSendsChangeForASegmentedChoice(t *testing.T) { + d := drawView(t, `[{"type":"segmented","id":"mode","label":"Mode","value":"first","options":[ + {"value":"first","label":"First"},{"value":"second","label":"Second"} + ]}]`) + d.click("Second") + if event := d.sent(); event["event"] != "change" || event["node"] != "mode" || event["value"] != "second" { + t.Fatalf("event = %v, want change of mode to second", event) + } +} + func TestDrawSendsSelectOnceAndActivateForATreeItem(t *testing.T) { d := drawView(t, `[{"type": "tree", "id": "modules", "label": "Modules", "items": [ {"id": "core", "label": "core", "detail": "3 files", "icon": "plugin"}, diff --git a/desktop/internal/pluginview/view_visual_test.go b/desktop/internal/pluginview/view_visual_test.go index 42bec67d18..c9f7a86b6a 100644 --- a/desktop/internal/pluginview/view_visual_test.go +++ b/desktop/internal/pluginview/view_visual_test.go @@ -23,6 +23,8 @@ const visualView = `[ {"type":"label","id":"count","text":"3 modules · 41 classes","style":"strong"}, {"type":"button","id":"refresh","text":"Refresh","icon":"refresh"}, {"type":"button","id":"build","text":"Build all","icon":"run","tone":"primary"}]}, + {"type":"segmented","id":"scope","label":"Scope","value":"all","options":[ + {"value":"all","label":"All modules"},{"value":"recent","label":"Recent"}]}, {"type":"textField","id":"filter","placeholder":"Filter modules","width":"fill"}, {"type":"tree","id":"modules","items":[ {"id":"core","label":"core","icon":"plugin","detail":"18 classes","expanded":true,"children":[ diff --git a/desktop/internal/settingswindow/stepping_view.go b/desktop/internal/settingswindow/stepping_view.go index 90bd333d35..52d5f78278 100644 --- a/desktop/internal/settingswindow/stepping_view.go +++ b/desktop/internal/settingswindow/stepping_view.go @@ -393,7 +393,11 @@ func (w *window) debuggerList(c ui.C, language i18n.Language) { k := r.C changed := w.steppingChanged(adapter) _, stored := w.effectiveFilters(adapter) - r.Element.Height(debuggerRow).PadSides(0, 12, 0, 14).Gap(9).Items(ui.Center).Hover(ui.Look{}.Background(b.hover)) + r.Element.Height(debuggerRow).PadSides(0, 12, 0, 14).Gap(9).Items(ui.Center) + // List also measures the row without a hit identity. + if !r.ID.IsZero() { + r.Element.Hover(ui.Look{}.Background(b.hover)) + } if r.Selected() { r.Element.Background(b.sel) } @@ -483,7 +487,7 @@ func (w *window) debuggerDetail(c ui.C, language i18n.Language, adapter Stepping ui.Column(c).FillWidth().MinWidth(0).Shrink(0).Radius(10).Border(1, b.line).Background(b.surface).Pad(6).Children(func() { for _, feature := range steppingFeatures(language, draft) { k := c.Part(feature.key) - ui.Row(k).FillWidth().MinHeight(34).PadX(8).PadY(3).Gap(10).Radius(7).Items(ui.Center).Hover(ui.Look{}.Background(b.hover)).Children(func() { + ui.Row(k).FillWidth().MinHeight(34).PadX(8).PadY(3).Gap(10).Radius(7).Items(ui.Center).Children(func() { ui.Row(k).Grow(1).Shrink(1).MinWidth(0).Gap(5).Items(ui.Center).Children(func() { ui.Text(k, feature.label).FontSize(buildFont).Color(b.text).Shrink(1).Ellipsis() w.infoButton(k.Part("help"), feature.help) @@ -510,7 +514,7 @@ func (w *window) patternList(c ui.C, language i18n.Language, draft *steppingDraf remove := -1 for index, pattern := range draft.patterns { k := c.KeyInt(index) - ui.Row(k).FillWidth().MinWidth(0).PadX(8).PadY(5).Gap(8).Items(ui.Center).Hover(ui.Look{}.Background(b.hover)).Children(func() { + ui.Row(k).FillWidth().MinWidth(0).PadX(8).PadY(5).Gap(8).Items(ui.Center).Children(func() { ui.Text(k, pattern).FontSize(buildMono).Mono().Color(b.text).Grow(1).Shrink(1).MinWidth(0).Ellipsis() if w.iconButton(k.Part("remove"), icons.X, i18n.Shared(language, "desktop.buildSettings.removePattern"), s.saving) { remove = index diff --git a/desktop/internal/settingswindow/visual_capture_test.go b/desktop/internal/settingswindow/visual_capture_test.go index da2a129c0a..d4daccd227 100644 --- a/desktop/internal/settingswindow/visual_capture_test.go +++ b/desktop/internal/settingswindow/visual_capture_test.go @@ -97,6 +97,12 @@ func TestVisualSettings(t *testing.T) { }, SetSteppingFilters: func(string, *core.DebugSteppingFilters) {}, } + if scenario.id == "20-settings-general" { + opts.WorkbenchBackground = func(i18n.Language) WorkbenchBackground { + return WorkbenchBackground{Set: true, Status: "fixture.png", Strength: "subtle", + Image: gfx.Bitmap{Width: 1, Height: 1, Stride: 4, ID: 1 << 62, Pix: []byte{72, 116, 158, 255}}} + } + } opts.SetAutoUpdatePlugins = func(bool) {} values := Values{Theme: theme, Language: language.Code(), TerminalScrollback: 2000, AutoUpdatePlugins: scenario.id == "m42-plugin-auto-update-on"} if scenario.id == "29-marketplace-recommendations" { diff --git a/desktop/internal/settingswindow/window_view.go b/desktop/internal/settingswindow/window_view.go index fa5fbd35a0..f6d6022194 100644 --- a/desktop/internal/settingswindow/window_view.go +++ b/desktop/internal/settingswindow/window_view.go @@ -579,7 +579,7 @@ func (w *window) generalPage(c ui.C) { w.cliCard(c) w.card(c, settings.Appearance, settings.AppearanceHelp, func() { choice := func() { - ui.Choice(c, &w.themePick, themeValues[:], w.themeLabel).Width(420).Shrink(1).MinWidth(0).Label(settings.AppearanceMode) + ui.Choice(c, &w.themePick, themeValues[:], w.themeLabel).Width(420).Shrink(1).MinWidth(0) } narrow := w.extent-2*contentPad-2*cardPad < 460 if narrow { diff --git a/desktop/internal/settingswindow/workbench_background_view.go b/desktop/internal/settingswindow/workbench_background_view.go index a771d68962..6fcb34641a 100644 --- a/desktop/internal/settingswindow/workbench_background_view.go +++ b/desktop/internal/settingswindow/workbench_background_view.go @@ -117,7 +117,7 @@ func (w *window) workbenchBackgroundRows(c ui.C, narrow bool) { strength := func() { ui.Choice(c.Part("background-strength"), &w.backgroundStrengthPick, workbenchBackgroundStrengths, func(value string) string { return workbenchBackgroundStrengthLabel(language, value) - }).Width(420).Shrink(1).MinWidth(0).Label(visibility) + }).Width(420).Shrink(1).MinWidth(0) } if narrow { ui.Column(c).FillWidth().Gap(8).PadY(6).Children(func() { diff --git a/desktop/internal/workbench/app.go b/desktop/internal/workbench/app.go index 8ebf4cc120..8b033cef93 100644 --- a/desktop/internal/workbench/app.go +++ b/desktop/internal/workbench/app.go @@ -1151,20 +1151,7 @@ func (a *App) Run() error { }) a.stopPluginAutoUpdates() a.windowLoopEnded(err, faulted.Load()) - for _, session := range a.sessions.everyOne() { - session.unsubscribeSettings() - session.stopWatchingDiagnostics() - session.closeProject() - session.wait() - if session.pluginDownloads != nil { - session.recordPluginInstallCleanup(context.Background(), session.pluginDownloads.Close()) - } - if session.plugins != nil && session.plugins.Runs != nil { - // Runs of the closed project are already stopped; this ends any the - // project close did not own and refuses new ones during shutdown. - session.plugins.Runs.StopAll() - } - } + a.shutdownSessions() if a.kernel != nil { // Every tab shares the kernel: this ends the remote sessions no closed project ended, // such as one the Remote Development window had open, and refuses new ones. @@ -1180,6 +1167,52 @@ func (a *App) Run() error { return err } +const ( + // Give plugin shutdown calls their own deadline before abandoning the final wait. + shutdownWait = pluginServerStopTimeout + 5*time.Second + shutdownWaitOperation = "workbench_shutdown_wait" +) + +// shutdownSessions runs after Viva returns, when no window can deliver a save or +// confirmation callback. The normal close requests finish those steps while the +// window is alive. Any project still present here needs resource teardown and +// recovery checkpoints for its unsaved documents. +func (a *App) shutdownSessions() { + sessions := a.sessions.everyOne() + for _, session := range sessions { + session.unsubscribeSettings() + session.stopWatchingDiagnostics() + session.closingProject = false + if p := session.project; p != nil { + session.disposeProject(p) + } + session.closePluginDownloads() + if session.plugins != nil && session.plugins.Runs != nil { + runs := session.plugins.Runs + // End runs that no project owned and refuse new ones during shutdown. + session.background(nil, 0, func(context.Context) func(*App) { + runs.StopAll() + return nil + }) + } + } + + done := make(chan struct{}) + go func() { + defer close(done) + for _, session := range sessions { + session.wait() + } + }() + timer := time.NewTimer(shutdownWait) + defer timer.Stop() + select { + case <-done: + case <-timer.C: + a.backgroundFailed(shutdownWaitOperation, context.DeadlineExceeded) + } +} + // watchFaults has Viva hand each panic it recovers in a callback to the client's log, as // app.runtime.panic_interrupted under the boundary viva:. Viva calls the handler on the // panicking thread, which may hold the framework's locks, so it only records and sets the @@ -1235,13 +1268,12 @@ func (a *App) systemAppearanceChanged() { }) } -// closed runs when the window has closed: the project closes, and so does the log window, -// which would otherwise keep the application running without the window it belongs to. +// closed releases auxiliary windows. Project close requests run before OnClosed, +// and shutdownSessions takes care of projects left over when the loop returns. func (a *App) closed() { a.unsubscribeSettings() a.closeClone() a.closeNewProject() - a.closeProject() a.closeSettingsWindow() a.stopUpdates() } @@ -1737,64 +1769,68 @@ func (a *App) finishCloseProject(p *project, after func()) { if a.project != p { return } - { - a.saveEditorSession(p) - a.closePluginViews(p) - a.releaseIndexing(p) - a.closeEverywhere(p) - a.recentFiles.open = false - a.recentFiles.generation++ - a.recentFiles.lastEdited = 0 - a.recentFiles.list = nil - a.recentFiles.listState = ui.ListState{} - a.drafts.open, a.drafts.loading = false, false - a.drafts.generation++ - a.drafts.entries = nil - a.drafts.list = ui.ListState{} - if a.navigation.open && a.navigation.project == p { - a.closeNavigation() - } - a.cancelPrompts() - a.ideAPIDisable(p) - a.closeRemoteWorkspace(p) - p.cancel() - a.closePluginPages() - a.closePreviewPages() - a.closeTree(p) - a.closeGitObservation(p) - a.releaseProjectSearch(p) - a.closeDocuments(p) - p.closeDiffs() - a.closeTerminals(p) - // A test run owns a process or provider request, so it is stopped before - // the build providers it borrowed close. - a.stopTestsForProject(p) - a.stopDebugForProject(p) - a.stopRunsForProject(p) - // Build providers and prepared applications belong to the workspace and - // are stopped before the project state is dropped. - a.stopBuild(p) - // Version control provider sessions run in the workspace too. - a.stopVcs(p) - // A language server is bound to the workspace it was started for, so it goes - // with the project rather than outliving it. - a.stopAllPluginServers() - a.clearAllPluginDiagnostics() - a.problems.reset() - a.toolchainRoot.Store(nil) - a.project = nil - a.ideAPISetProject(nil) - a.focus = focusTarget{} - a.dnd.tool.Cancel() - a.dnd.tab.Cancel() - a.drag, a.term.drag = dragState{}, tabDrag{} - a.title = titleState{} - a.branch.branchSession = branchSession{} - if after != nil { - after() - } else { - // A project closed on its own leaves its tab when the window has others. - a.sessions.leave(a) - } + a.disposeProject(p) + if after != nil { + after() + } else { + // A project closed on its own leaves its tab when the window has others. + a.sessions.leave(a) } } + +// disposeProject releases a project after close approval or after the window +// loop has returned. It does not ask questions or switch tabs. +func (a *App) disposeProject(p *project) { + a.saveEditorSession(p) + a.closePluginViews(p) + a.releaseIndexing(p) + a.closeEverywhere(p) + a.recentFiles.open = false + a.recentFiles.generation++ + a.recentFiles.lastEdited = 0 + a.recentFiles.list = nil + a.recentFiles.listState = ui.ListState{} + a.drafts.open, a.drafts.loading = false, false + a.drafts.generation++ + a.drafts.entries = nil + a.drafts.list = ui.ListState{} + if a.navigation.open && a.navigation.project == p { + a.closeNavigation() + } + a.cancelPrompts() + a.ideAPIDisable(p) + a.closeRemoteWorkspace(p) + p.cancel() + a.closePluginPages() + a.closePreviewPages() + a.closeTree(p) + a.closeGitObservation(p) + a.releaseProjectSearch(p) + a.closeDocuments(p) + p.closeDiffs() + a.closeTerminals(p) + // A test run owns a process or provider request, so it is stopped before + // the build providers it borrowed close. + a.stopTestsForProject(p) + a.stopDebugForProject(p) + a.stopRunsForProject(p) + // Build providers and prepared applications belong to the workspace and + // are stopped before the project state is dropped. + a.stopBuild(p) + // Version control provider sessions run in the workspace too. + a.stopVcs(p) + // A language server is bound to the workspace it was started for, so it goes + // with the project rather than outliving it. + a.stopAllPluginServers() + a.clearAllPluginDiagnostics() + a.problems.reset() + a.toolchainRoot.Store(nil) + a.project = nil + a.ideAPISetProject(nil) + a.focus = focusTarget{} + a.dnd.tool.Cancel() + a.dnd.tab.Cancel() + a.drag, a.term.drag = dragState{}, tabDrag{} + a.title = titleState{} + a.branch.branchSession = branchSession{} +} diff --git a/desktop/internal/workbench/editor_recovery.go b/desktop/internal/workbench/editor_recovery.go index f02c325122..99e3ffaa37 100644 --- a/desktop/internal/workbench/editor_recovery.go +++ b/desktop/internal/workbench/editor_recovery.go @@ -99,7 +99,7 @@ func (a *App) enqueueCheckpoint(job checkpoint) { } writer.running = true writer.mu.Unlock() - a.background(nil, 0, func(context.Context) func(*App) { + a.background(nil, 0, func(ctx context.Context) func(*App) { for { writer.mu.Lock() var next checkpoint @@ -132,7 +132,9 @@ func (a *App) enqueueCheckpoint(job checkpoint) { } } if err != nil { - a.post(func(a *App) { a.recoveryFailed(err) }) + // The shutdown checkpoint may finish after the window stops draining. + a.operationFailedIn(ctx, "editor_recovery", documentLogError(err)) + a.post(func(a *App) { a.notifyError(i18n.Shared(a.language(), "desktop.drafts.failed")) }) } if next.after != nil { a.post(next.after) diff --git a/desktop/internal/workbench/fault_test.go b/desktop/internal/workbench/fault_test.go index c6a0e1d28b..cd1bba4da3 100644 --- a/desktop/internal/workbench/fault_test.go +++ b/desktop/internal/workbench/fault_test.go @@ -1,10 +1,14 @@ package workbench import ( + "context" "errors" + "os" + "path/filepath" "sync" "sync/atomic" "testing" + "time" "github.com/1lck/Lithe-IDEA/desktop/internal/core" "github.com/1lck/Lithe-IDEA/desktop/internal/logstore" @@ -94,3 +98,67 @@ func TestAFailedWindowLoopIsLogged(t *testing.T) { } (&App{}).windowLoopEnded(errors.New("no log"), false) } + +func TestWindowLoopShutdownCancelsServerAndKeepsUnsavedDraft(t *testing.T) { + h := newHarness(t, &testKernel{Client: core.NewClient()}) + h.app.settings.DisableAutoSave = true + root := t.TempDir() + path := filepath.Join(root, "note.txt") + if err := os.WriteFile(path, []byte("on disk"), 0o600); err != nil { + t.Fatal(err) + } + h.app.openProject(root) + h.await("the project to open", func() bool { return h.app.project != nil }) + p := h.app.project + h.app.openFile(p, path) + h.await("the document to open", func() bool { return p.docs.byPath(path) != nil }) + d := p.docs.byPath(path) + + // A synthetic serve loop owns a task until its server is cancelled. Its + // deadline releases the old shutdown path, so a failure cannot hang the suite. + ctx, cancel := context.WithCancel(t.Context()) + defer cancel() + served := make(chan error, 1) + h.app.pluginServers = map[string]*pluginServer{"dev.lithe.test.shutdown": {cancel: cancel}} + h.app.background(nil, time.Second, func(deadline context.Context) func(*App) { + select { + case <-ctx.Done(): + served <- ctx.Err() + case <-deadline.Done(): + served <- deadline.Err() + } + return nil + }) + // A close has started when Viva stops the window loop. No frame is + // pumped to apply the document check after it. + h.app.closeProject() + h.app.closed() + if !h.app.closingProject { + t.Fatal("document close check was not pending at window shutdown") + } + input := d.view.TextInput(app.TextInputContext{ID: d.hit}) + if _, err := input.OnEvent(app.TextEvent{Kind: app.TextInsert, Text: "unsaved "}); err != nil { + t.Fatal(err) + } + want := d.view.TextSnapshot().String() + h.app.shutdownSessions() + + select { + case err := <-served: + if !errors.Is(err, context.Canceled) { + t.Fatalf("server exited at its deadline instead of being cancelled during shutdown: %v", err) + } + case <-time.After(time.Second): + t.Fatal("server did not exit during shutdown") + } + if h.app.project != nil || p.ctx.Err() == nil || h.app.closingProject { + t.Fatal("window shutdown did not finish closing the project") + } + draft, found, err := h.app.recovery.store.Load(p.root, path) + if err != nil || !found || draft.Text != want { + t.Fatalf("recovery text = %q, want %q, found = %t, error = %v", draft.Text, want, found, err) + } + if disk, err := os.ReadFile(path); err != nil || string(disk) != "on disk" { + t.Fatalf("disk text = %q, error = %v", disk, err) + } +} diff --git a/desktop/internal/workbench/runconfig_form_view.go b/desktop/internal/workbench/runconfig_form_view.go index e900a7d4bb..b2e713a0a9 100644 --- a/desktop/internal/workbench/runconfig_form_view.go +++ b/desktop/internal/workbench/runconfig_form_view.go @@ -401,7 +401,7 @@ func (a *App) drawRunConfigFormControl(c ui.C, p *project, f *runConfigForm, fie box := ui.TextArea(c, f.texts[field.ID], label, placeholder) area := f.textArea(field.ID) height := runConfigTextAreaHeight(c.Theme(), area.rows(c, *f.texts[field.ID])) - if box.Mono().Grow(1).MinWidth(0).MinHeight(height).Height(height).Draw(area.hook).Disabled(!ready).Changed() { + if box.Grow(1).MinWidth(0).MinHeight(height).Height(height).Draw(area.hook).Disabled(!ready).Changed() { edited() } case runFieldFile, runFieldExecutable, runFieldDirectory: diff --git a/scripts/desktop/check.sh b/scripts/desktop/check.sh index 51b3b6eb4d..21181df8ad 100755 --- a/scripts/desktop/check.sh +++ b/scripts/desktop/check.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash # Runs the checks every platform lane runs, so macOS, Linux and Windows verify the same code the -# same way: formatting, vet and tests, with the dev-tagged buildinfo package on every platform. +# same way: formatting, vet and tests, with dev-tagged build info and UI tests on every platform. # A lane that skips one of these silently verifies less than its neighbours. set -euo pipefail @@ -17,4 +17,4 @@ fi "$GO" vet ./... "$GO" vet -tags dev ./... "$GO" test ./... -"$GO" test -tags dev ./internal/buildinfo +"$GO" test -tags dev ./internal/buildinfo ./internal/settingswindow ./internal/pluginview ./internal/workbench diff --git a/shared/platform-feature-matrix/features/window-controls.json b/shared/platform-feature-matrix/features/window-controls.json index 18a97caad0..5b1c0e92cb 100644 --- a/shared/platform-feature-matrix/features/window-controls.json +++ b/shared/platform-feature-matrix/features/window-controls.json @@ -8,7 +8,8 @@ "verificationStatus": "pending", "evidence": [ "desktop/internal/workbench/root.go", - "desktop/internal/workbench/chrome_view.go" + "desktop/internal/workbench/chrome_view.go", + "desktop/internal/workbench/fault_test.go" ] }, "windows": { @@ -19,11 +20,12 @@ "desktop/internal/windowcontrols/style_test.go", "desktop/internal/workbench/app.go", "desktop/internal/settingswindow/window.go", - "desktop/internal/logwindow/window.go" + "desktop/internal/logwindow/window.go", + "desktop/internal/workbench/fault_test.go" ] }, "owner": "Workbench", - "verification": "在 macOS 检查系统标题栏控制及全屏入口,并确认绿色按钮进入独立全屏 Space(窗口 styleMask 出现 fullScreen、frame 覆盖整屏)而不是在主桌面最大化,退出后窗口回到原位置;进入全屏后确认工作台顶栏内容从左缘开始、不再保留红绿灯按钮空位,退出全屏后恢复按钮预留;在 Windows 验证标题栏最小化、最大化/还原和关闭,以及命令面板的窗口操作,确认图标语义、最大化/还原状态与按钮标签一致,并确认悬停关闭按钮背景贴合窗口右边缘。抓住工作台和设置窗口的边缘连续调整尺寸,检查拖动期间内容持续重绘,松开后内容与窗口最终尺寸对齐;最小化并还原后确认仍可正常调整尺寸。 macOS 同一窗口角色下更新模型和标题时保留 SwiftUI 宿主测量的最小内容尺寸,切换欢迎页/工作台角色仍应用对应尺寸,避免重复覆盖引发窗口布局反馈。", + "verification": "在 macOS 检查系统标题栏控制及全屏入口,并确认绿色按钮进入独立全屏 Space(窗口 styleMask 出现 fullScreen、frame 覆盖整屏)而不是在主桌面最大化,退出后窗口回到原位置;进入全屏后确认工作台顶栏内容从左缘开始、不再保留红绿灯按钮空位,退出全屏后恢复按钮预留;在 Windows 验证标题栏最小化、最大化/还原和关闭,以及命令面板的窗口操作,确认图标语义、最大化/还原状态与按钮标签一致,并确认悬停关闭按钮背景贴合窗口右边缘。抓住工作台和设置窗口的边缘连续调整尺寸,检查拖动期间内容持续重绘,松开后内容与窗口最终尺寸对齐;最小化并还原后确认仍可正常调整尺寸。 macOS 同一窗口角色下更新模型和标题时保留 SwiftUI 宿主测量的最小内容尺寸,切换欢迎页/工作台角色仍应用对应尺寸,避免重复覆盖引发窗口布局反馈。在语言服务器运行时中断窗口循环,确认项目后台任务退出,未保存内容保留为恢复草稿,原文件内容保持原状。", "legacy": { "revision": "5a54c41aa37a4e6e6b68918a4b05765b9dd07a36", "macos": { diff --git a/shared/platform-feature-matrix/features/workbench-settings-entry.json b/shared/platform-feature-matrix/features/workbench-settings-entry.json index 6496c4895a..b51f54fcdd 100644 --- a/shared/platform-feature-matrix/features/workbench-settings-entry.json +++ b/shared/platform-feature-matrix/features/workbench-settings-entry.json @@ -9,7 +9,8 @@ "evidence": [ "docs/viva-migration.md", "desktop/internal/workbench/chrome_view.go", - "desktop/internal/workbench/catalog.go" + "desktop/internal/workbench/catalog.go", + "desktop/internal/settingswindow/visual_capture_test.go" ] }, "windows": { @@ -18,11 +19,12 @@ "evidence": [ "docs/viva-migration.md", "desktop/internal/workbench/chrome_view.go", - "desktop/internal/workbench/catalog.go" + "desktop/internal/workbench/catalog.go", + "desktop/internal/settingswindow/visual_capture_test.go" ] }, "owner": "Workbench", - "verification": "在 Windows 打开工作区,确认左侧活动栏底部不再显示设置齿轮,活动栏右键“在活动栏中显示”列表不包含设置项;点击标题栏右上搜索按钮右侧的齿轮打开设置对话框并再次关闭;携带旧版设置文件(活动栏排序或隐藏列表含 settings)启动后确认遗留条目被清理且活动栏显示正常。macOS 通过应用菜单和各面板入口打开设置保持不变。", + "verification": "在 Windows 打开工作区,确认左侧活动栏底部不再显示设置齿轮,活动栏右键“在活动栏中显示”列表不包含设置项;点击标题栏右上搜索按钮右侧的齿轮打开设置对话框并再次关闭;携带旧版设置文件(活动栏排序或隐藏列表含 settings)启动后确认遗留条目被清理且活动栏显示正常。macOS 通过应用菜单和各面板入口打开设置保持不变。用 dev 构建打开设置,检查通用页首帧、外观切换和选定背景后的可见度选项,再切换到调试器页确认列表与悬停交互正常。", "legacy": { "revision": "5a54c41aa37a4e6e6b68918a4b05765b9dd07a36", "macos": {