Repository navigation
Conversation
yiqiui
force-pushed
the
fix/303-completion-default-off
branch
from
November 4, 2026 16:36
73d9e26 to
7df60be
Compare
Closes t8y2#303 The completion mode (list, inline ghost, or both) suggested commands the host does not have, and the reporter asked for suggestions to start off. The mode lived only in two boolean flags whose 'both' spelling is also the older default, so a plain default flip could neither take effect (restore overwrites from the file) nor pin an explicit 'both' (both false is dropped by omitempty). Give the mode its own shared record, 'command_completion', written only against the new default; it outranks the older flags when present, the flags keep their meaning for catalogs written by older builds, and a catalog with neither record nor flags — a choice never expressed — takes the new default. The state the config defaults are taken from initializes to the new default, so a reader who picks List or Both has the choice written and pinned across restarts. Every previously recorded choice keeps its meaning; only catalogs that never recorded one move to the new default.
yiqiui
force-pushed
the
fix/303-completion-default-off
branch
from
November 11, 2026 16:07
7df60be to
91140a3
Compare
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.
Summary
补全建议(列表 + 灰色内联提示)会把主机上不存在的命令也提示出来(如输入
pwd建议pwdx、nc建议ncdu),造成困惑。按 issue 诉求,把补全模式的默认值从「列表+内联」改为「关闭」;需要建议的用户在设置里打开即可。实现上的关键点(为什么不是一行改默认值):
omitempty会把 false 丢掉,所以直接翻转默认既不会生效(restore无条件用文件覆盖),也无法钉住用户显式选择的 both。command_completion(list/both,缺省 = 新默认 off)。记录存在时权威;缺失时回退到旧布尔位(老构建写的目录语义不变);两者皆无 = 从未表达过偏好 → 取新默认。newState在生成 config 默认值快照之前初始化为新默认,使「选 List/Both」成为与默认的差异而被写盘钉住,跨重启不丢。Behavior
Test plan
TestEarlierCompletionPreferencesKeepTheirMeaning:旧布尔位三种记录 + 新记录三种取值 + 记录优先于旧布尔,全部按预期读取。TestAChoiceAgainstTheCompletionDefaultIsPinned:全新状态=Off;显式选 Both → save → 重启后仍是 Both(钉住不丢)。TestCompletionControlsAndKeysHaveSeparateSettingsHomes:设置页默认选中态 = Off(en/zh-CN 双语)。ghostWorld/newCompletionWorld助手固化前置条件)。go build ./...、gofmt、go vet通过;Settings/Persist/Shortcut/Record 等中范围回归全绿。Closes #303