Repository navigation
feat(run): 运行控制台加自动换行开关,沿用 Git 控制台的换行与省略号 - #2138
Merged
Merged
Conversation
- 运行控制台右侧工具栏第一个按钮是“自动换行”开关,与 Git 控制台共用文案和图标, 读屏读作开关并报告开/关;状态对所有执行标签一起生效,退出前一直有效。 - 关闭时长行在右边缘以省略号结尾,打开时在空格处折行;颜色与链接仍走 textview Spans。 - 输出缓冲加修改计数 revision,textview 只在输出或宽度变化时重新折行。 - 测试窗口的失败输出不显示开关,保持省略号。 - 新增开关、revision 的单元测试与明暗主题 × 中英文的无头截图,补功能矩阵条目。
xiaoyumuxi
marked this pull request as ready for review
November 18, 2026 06:13
This was referenced Nov 18, 2026
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.
关联 Issue / Linked issue
PR 类型 / Type
改动说明 / What changes
背景 / Why
Viva 桌面端的运行控制台没有自动换行开关,长行在右边缘直接被截断,也不能左右滚动。比如运行 Makefile 时,编译命令的长参数和行尾的警告、错误都看不到。旧客户端在 #652 做过这个开关,但旧客户端已在 #1799 删除,Viva 运行控制台没把它带过来。同一窗口的 Git 控制台已经有这个开关,所以这次直接沿用 Git 控制台的做法,不改 Viva。着色仍只走 textview 的 Spans,以后插件给运行输出着色也走这条路径。
改动 / Changes
运行控制台(
desktop/internal/workbench/run_view.go)git.console.wrap,图标icons.WrapText。colors.Active的按下背景。无障碍角色是RoleSwitch,并带Checked状态,读屏会报告开/关。performed("run.console.wrap", surfaceButton),和 Git 控制台的git.console.wrap一样。runToolButton拆出共用的runToolIcon,新增runToolToggle给开关用,按钮的外观和行为不变。开关状态(
app.go)App.runWrap,所有执行标签共用,退出前一直有效,不写入设置。Git 控制台的开关也是这样。输出列表(
outputlinks_view.go)outputList新增参数wrap。textview 的 Spec 设为Wrap: wrap, Ellipsis: true, Revision: output.revision,与 Git 控制台相同:关闭时长行以“…”结尾,打开时在空格处折行。输出缓冲(
output_style.go)outputBuffer新增修改计数revision,apply()和clear()时加一。textview 因此只在输出、宽度或可见范围变化时重新折行,不会每帧把最多 4000 行全部重折一遍。测试窗口(
tests_view.go)wrap=false,保持省略号。测试
run_panels_test.go:新增TestRunConsoleWrapSwitchBreaksLongLinesInsteadOfCuttingThem。用真实点击驱动开关,检查以下几点:RoleSwitch,关闭时长行看不到结尾并显示“…”;outputlinks_test.go:新增TestOutputBufferRevisionChangesWithEveryChangeItShows。逐项检查以下变化都会改变 revision:run_console_wrap_visual_test.go(vivahead && lithevisual):新增无头截图测试TestVisualRunConsoleWrap。文档与矩阵
docs/assets/run-console-wrap/:4 张截图和 README。shared/platform-feature-matrix/features/run-console-soft-wrap.json:新增条目,两端implemented / pending。不在本 PR 范围内 / Out of scope
ui.List加RowWidth实现了左右滚动,但那样会失去 textview 的跨行选择和 Spans 着色,这次也不采用。pending。类型专属:feat
多平台对齐
desktop/internal/workbench),没有平台分支,合入后两端都具备platform-specific),理由:范围检查 / Scope checks
功能矩阵 / Feature matrix
shared/platform-feature-matrix/features/run-console-soft-wrap.json:两端implemented,验证状态pending(原生验收没做),证据路径、owner(Run)和验证动作都已填写./scripts/platform-feature-matrix/verify-platform-feature-matrix.sh(validated 204 platform capabilities)和./scripts/platform-feature-matrix/verify-platform-feature-matrix-change.sh origin/main HEAD(matrix change gate passed).artifacts/下生成的矩阵视图插件归属 / Plugin ownership
develop-lithe第三节“插件归属与宿主零依赖”的自查命令,结果为空outputLinkManifest,IDdev.lithe.test.output-links)和测试注入的合成构建输出,没有读取具体插件shared/i18n/,也没有插件构建步骤写进文档UI 验证 / UI evidence
LITHE_VISUAL_OUTPUT_DIR=<dir> scripts/desktop/desktop-go.sh test -tags vivahead,lithevisual ./internal/workbench -run '^TestVisualRunConsoleWrap$' -count=1 -timeout 180s。代码为本 PR 的 5b3ee58(截图生成后只改过矩阵条目的 notes 文字),场景为开关关闭/打开,主题与语言为深色中文、浅色英文,尺寸 1200×760docs/assets/run-console-wrap/统一日志系统 / Structured logging
app.action.performed事件(performed("run.console.wrap", surfaceButton))记录动作,写法与 Git 控制台的git.console.wrap相同;没有新增事件 ID,没有print或直接写 stderr界面文案 / i18n
git.console.wrap(“自动换行”/“Soft wrap”),通过desktop/internal/i18n的i18n.Shared读取node scripts/i18n/verify-app-language-localization.mjs、node scripts/i18n/generate-i18n.mjs --check(en、zh 均 11578/11578)和node scripts/i18n/test-i18n.mjs(41 通过,0 失败),没有放宽脚本逻辑归属 / Logic placement
性能与内存 / Performance and memory
revision是一个uint64计数,开关只是一个布尔值Revision只在输出、宽度或可见范围变化时重新折行,避免每帧重折最多 4000 行;默认关闭时走Ellipsis。这只是从实现推断,没有测量数据;Viva 编辑器基准不覆盖运行控制台设置 / Settings
N/A:没有新增或修改设置项。开关是控制台工具栏上只在本次运行内有效的状态,不写入设置,和 Git 控制台一致。
插件契约 / Plugin contract
N/A:不依赖也不修改插件契约、能力版本或宿主方法。
发行包与资源 / Bundle and resources
N/A:没有新增或修改运行时资源、缓存、下载物或构建步骤。
无用代码与重构 / Dead code and refactoring
runToolButton改为调用共用的runToolIcon,原有调用方不变验证 / Verification
cd desktop && ../scripts/desktop/desktop-go.sh test ./... -count=1internal/workbench用时 235.7s,没有 FAILscripts/desktop/desktop-go.sh test ./internal/workbench -run 'TestRunConsole|TestOutputBuffer' -count=1 -vTestRunConsole*7 个(含新增的换行开关测试)和TestOutputBufferRevisionChangesWithEveryChangeItShowsTestVisualRunConsoleWrap(-tags vivahead,lithevisual,命令见上方 UI 验证)./scripts/platform-feature-matrix/verify-platform-feature-matrix.sh./scripts/platform-feature-matrix/verify-platform-feature-matrix-change.sh origin/main HEADnode scripts/i18n/verify-app-language-localization.mjs;node scripts/i18n/generate-i18n.mjs --check;node scripts/i18n/test-i18n.mjs./.agents/skills/write-stable-tests/scripts/verify-test-stability.shdevelop-lithe第三节插件归属自查rggofmt -l desktop/internal/workbench/未能执行的检查和原因:
pending。verify-runtime-bundle-immutability.sh:没有运行,本次没有改运行时资源。提交前确认 / Final checks
main(5ebc5c1e0)创建,目标分支为main