Repository navigation
fix(desktop): Run 控制台、Git Log 详情和 Git 控制台可以选择和复制 - #2085
Merged
Merged
Conversation
Viva 迁移后,这三处把每行画成不可选的 ui.Text,鼠标拖不出选区,也不能复制。 - 新增 desktop/internal/textview:只读文本视图,按等宽字符格逐行绘制,只声明屏幕上的行, 选区按 IntelliJ IDEA 的习惯:拖动(含跨行、拖出边缘自动滚动)、双击选词、三击选行、 Shift+点击扩展、Primary+A 全选、Primary+C 复制、Esc 取消;内容不可编辑。 - Run 窗口和测试输出控制台改用 textview,保留 ANSI 颜色、输出链接、跟随最新输出、清空、 滚动到末尾和右键菜单(复制选区或当前行、复制输出、全选)。 - Git Log 提交详情把标题、哈希/作者/邮箱/日期和正文作为一段等宽文字显示,可选可复制, 引用标签移到文字下方。 - Git 控制台改用 textview:命令头的临时配置仍是行内折叠开关,其他折叠的“展开 N 行”和 运行中徽标画在行尾、不进入选区;不换行时保留省略号,换行时为行尾留列;搜索命中行高亮、 跳转时居中滚动;重新排行后选区跟着原来的行;右键菜单新增复制和全选,保留复制命令、 输出、路径。删除旧的列表行布局代码。 - textview 的 Copied 回调改为 Copy(text),由调用方记录操作并写剪贴板。 - 新增功能矩阵条目 readonly-text-selection,补充单元测试、界面测试和无头截图场景。
xiaoyumuxi
marked this pull request as ready for review
November 17, 2026 05:54
This was referenced Nov 17, 2026
15 of 18 tasks
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 后,Run 窗口和测试输出的控制台、Git Log 的提交详情、Git 工具窗口的 Console 都把每一行画成不可选的
ui.Text。用户不能用鼠标选中文字,也不能复制堆栈、哈希或命令输出,macOS 和 Windows 都是这样。这些区域应当是普通的只读文本:可以选择、可以复制,只是不能编辑。选择和复制的操作按 IntelliJ IDEA 的习惯来。改动 / Changes
新增共享只读文本视图
desktop/internal/textviewView、Selection、Source:按等宽字符格逐行绘制,只声明屏幕上的行;超长行按字符格切断或换行。Span.Hover、Span.Label)。Spec的新字段:Trail:画在行尾的徽标或按钮,不进入选区,点击时调用PressTrail;LineBackground:整行底色;Ellipsis:不换行时超长行以…结尾;Revision:内容没有变化时复用换行排版。ScrollTo(n)把第 n 行居中滚入视野;Selection.Lines()和Selection.Move()供重新排行后找回选区。Copied func()改为Copy func(text),由调用方记录操作并写剪贴板。Run 窗口和测试输出控制台(
run_view.go、outputlinks_view.go、runpanels.go、runs.go)ui.List加ui.Text改为textview。Git Log 提交详情(
gitlog_details_view.go、gitlog_page.go)Git 控制台(
gitconsole_view.go、gitconsole.go)textview。consolePiece、行 key 分配、detach等。功能矩阵
shared/platform-feature-matrix/features/readonly-text-selection.json,两端实现状态为 implemented,验证状态为 pending。测试
textview/selection_test.go:选区、选词、按行号记录。workbench/console_selection_test.go:workbench/gitconsole_test.go:新增“重新排行后选区跟随原来的行”;原有 key 相关断言改为按 id 比较。workbench/gitlog_details_test.go:双击复制哈希、全选复制整段。context_menu_test.go、run_panels_test.go:适配新的菜单和视图。workbench/readonly_text_selection_visual_test.go:新增无头截图场景,带vivahead、lithevisual标签,默认不运行。不在本 PR 范围内 / Out of scope
类型专属:fix
复现与根因
ui.List,每行一个ui.Text或画布文字,没有任何选区逻辑。检查项
textview的选区接口(PointOf、Text)驱动和断言,修复前这些接口不存在,无法在修复前运行。修复前的状态以下方 7e7197f 上的“改动前”截图和上面的复现步骤为准。Copied改为Copy;outputList、outputLineMenu的签名;consoleView删除的字段;textview只在本仓库 workbench 中使用范围检查 / Scope checks
功能矩阵 / Feature matrix
shared/platform-feature-matrix/features/readonly-text-selection.json,两端 implemented、验证状态 pending,证据和验证动作已填写verify-platform-feature-matrix.sh(validated 196 platform capabilities)和verify-platform-feature-matrix-change.sh origin/main HEAD(passed).artifacts/下的矩阵视图插件归属 / Plugin ownership
N/A:只改宿主的通用只读文本控件,不涉及插件、插件 ID 或插件资源。
UI 验证 / UI evidence
LITHE_VISUAL_OUTPUT_DIR=<dir> scripts/desktop/desktop-go.sh test -tags vivahead,lithevisual -run TestVisualReadOnlyTextSelection ./internal/workbench/docs/assets/readonly-text-selection/)Run 控制台
Git Log 提交详情:改为等宽、可选,引用标签移到下方
Git 控制台:布局不变,行尾的“展开 N 行”不进入选区
统一日志系统 / Structured logging
N/A:没有新增生命周期、降级或失败路径。复制和全选沿用已有的
performed()操作记录(output.copySelection、git.log.copyDetails、git.console.copySelection、git.console.selectAll),不记录被复制的内容。界面文案 / i18n
menu.copy、menu.selectAllnode scripts/i18n/verify-app-language-localization.mjs(passed)和node scripts/i18n/generate-i18n.mjs --check(中英 11402/11402)逻辑归属 / Logic placement
性能与内存 / Performance and memory
Revision不变时不重新排版;没有轮询、子进程或新依赖;选区只保存四个位置editor-bench不适用;长输出仍有runOutputMaxLines上限设置 / Settings
N/A:没有新增或修改设置。
插件契约 / Plugin contract
N/A:不涉及契约和宿主方法。
发行包与资源 / Bundle and resources
scripts/desktop/verify/verify-runtime-bundle-immutability.sh(macOS 和 Windows 的静态检查通过)docs/ci-builds.md:没有新增下载、解压或缓存资源无用代码与重构 / Dead code and refactoring
consolePiece、layoutConsoleRow、drawConsoleRow、行 key、detach、outputLine、outputSegment等验证 / Verification
scripts/desktop/desktop-go.sh vet ./internal/textview/ ./internal/workbench/scripts/desktop/desktop-go.sh test ./internal/... -count=1(rebase 前)scripts/desktop/desktop-go.sh test ./internal/... -count=1(rebase 到最新 main、Core 固定 6a29169 后)localshell的TestClosingAnIntegratedShellRightAfterACommandHangsUpItsJobs偶发失败一次,本分支未改 localshell,单独重跑-count=3全部通过TestGitConsoleSelectsAndCopiesItsRows、TestConsoleFlattenKeepsTheSelectionOnItsRows等新测试TestVisualReadOnlyTextSelection(vivahead、lithevisual 标签)verify-platform-feature-matrix.sh/verify-platform-feature-matrix-change.sh origin/main HEADverify-app-language-localization.mjs/generate-i18n.mjs --check.agents/skills/write-stable-tests/scripts/verify-test-stability.sh --base origin/mainsettle、await,没有 sleep)scripts/desktop/verify/verify-runtime-bundle-immutability.sh未能执行的检查和原因:
test-stability-macos.sh对新测试的计时报告在 rebase 后的全量测试完成后补充。提交前确认 / Final checks
main,目标分支maindocs/assets/,按仓库惯例提交