Repository navigation
fix(settings): 恢复默认设置时重置终端回滚和光标 (#2019) - #2037
Merged
Merged
Conversation
lithe-support
Bot
requested review from
1lck,
Mucheen and
xiaoyumuxi
as code owners
November 16, 2026 10:32
Contributor
Author
…019-terminal-reset
两个能力原先写着同一段话;改为各写自己那项设置,并列出覆盖它的测试名。
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
Closes #2019
PR 类型 / Type
改动说明 / What changes
背景 / Why
设置窗口「恢复默认设置」只调用默认 Shell 和行为开关的重置,遗漏终端回滚行数及光标形状、粗细。#2022 已合并,但其正文明确把 #2019 列为未处理,本次核对其 diff 与当前 main 后独立复现。
改动 / Changes
force约定:显式重置会清除显示为默认的未知保存值;普通未变化选择不重复写入,关闭会话仍拒绝写入。TestKeymapAddRecordsTheChordPressedAfterIt失败来自它;Linux 的 localshell 失败是 main 既有问题);功能矩阵里 terminal-shell 与 terminal-interaction 原先写着同一段 [Bug] 「恢复默认设置」没有恢复终端的回滚行数和光标形状、粗细 #2019 说明,改为回滚行数归终端 Shell、光标归终端交互,并列出覆盖的测试名。不在本 PR 范围内 / Out of scope
不改变默认值、设置存储格式、Shell 配置或运行中终端生命周期。保存仍沿用现有路径,UI 线程同步保存的 #2021 不在本次处理;macOS/Windows 原生验收未执行。
类型专属:fix
复现与根因
在未改产品代码的 main
cad5656005288a7ef5897abd9d15494d2faf2fde,用真实设置窗口点击 Restore Defaults:非默认值、未知保存值两场景均因 scrollback/cursor 回调为空而失败。根因是 footer 漏调用,加上两 setter 的归一化比较会略过未知值重置;未追溯最初引入提交。.agents/notes/implemented/bug-fix/2026-11-16-terminal-settings-restore-defaults.md。范围检查 / Scope checks
功能矩阵 / Feature matrix
插件归属 / Plugin ownership
UI 验证 / UI evidence
统一日志系统 / Structured logging
N/A:不新增事件或失败路径,保存回调沿用既有工作台诊断。
界面文案 / i18n
N/A:无新文案,复用既有中英文默认选项。
逻辑归属 / Logic placement
本次仅补设置窗口动作及交付生命周期,不改默认值或解析规则,不复制 Core 业务规则。
性能与内存 / Performance and memory
无新进程、轮询、缓存或依赖。显式 reset 多调用已有回调;保存仍使用已有同步路径(#2021),未声明性能提升,未测原生启动/常驻内存基线。
设置 / Settings
打开页面不写设置,未知值只有显式重置时清除;正常相同选择不重复回调,关闭后不再写入。回滚值继续由现有 ClampScrollback 和工作台的默认值存储约定处理。
插件契约 / Plugin contract
N/A:无插件接口或 SDK 改动。
发行包与资源 / Bundle and resources
N/A:无新资源或运行时目录;发行包只读静态检查仍执行通过。
无用代码与重构 / Dead code and refactoring
验证 / Verification
环境:Linux amd64、Go 1.27.3、Rust 1.100.0、固定 Core
957a349a5d8b571d416925c8231509572c2053f5、Viva97fdbdde326b,均通过官方 desktop-go.sh 链接真实 Core。设置所有方为隔离回调,不修改用户偏好或启动用户 Shell。^TestTerminalRestoreDefaultsReachesOwnerAndPage对应两个子场景LITHE_VISUAL_OUTPUT_DIR=… scripts/desktop/desktop-go.sh test -tags 'vivahead lithevisual' ./internal/settingswindow -run '^TestVisualTerminalRestoreDefaults$' -count=1scripts/desktop/desktop-go.sh vet ./internal/settingswindow全包/全套不是全绿:
settingswindow -race中既有TestKeymapAddRecordsTheChordPressedAfterIt因editor.selectAllOccurrences already holds Ctrl+Alt+Shift+J失败。在未修改 main 独立复跑 10 次均同样失败。新终端回归未失败。全套
scripts/desktop/desktop-go.sh test -p 1 -json ./... -count=1 -timeout=360s已完成:56 包通过、12 包跳过、2 包失败;4127 条测试/子测试通过、28 跳过、4 失败记录(含失败父测试)。workbench 整包通过。两个失败包为上述 settingswindow/keymap,以及 localshell 的
TestClosingAnIntegratedShellHangsUpTheShellAndItsJobs(bash 子场景等待退出超时)和TestIntegratedSystemBashReportsEachCommandLineOnce(command-start 为 2,期望 1)。两项 Shell 失败也在同一未修改 main 独立重跑复现。没有改这些既有测试或其产品代码,不把全套失败标为通过。原生 macOS/Windows 未测,CI 结果另列。草稿回归显式注入“已有编辑草稿”来验证 reset 清理,不声称覆盖键盘数字输入;初次草稿测试 setup 不成立,修正为该明确场景后复跑。
提交前确认 / Final checks