fix(tui): align slash autocomplete descriptions for CJK aliases - #1981
Open
Iwctwbh wants to merge 1 commit into
Open
fix(tui): align slash autocomplete descriptions for CJK aliases#1981Iwctwbh wants to merge 1 commit into
Iwctwbh wants to merge 1 commit into
Conversation
The slash popup padded command names with String.length/padEnd, which counts UTF-16 code units instead of terminal columns. Chinese skill aliases (e.g. /前端设计) render two cells per character, so those rows were wider than the padding budget and the right-hand description column was jagged. Pad in display columns with Bun.stringWidth instead. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
yanyihan-xiaomi
approved these changes
Jul 31, 2026
yanyihan-xiaomi
left a comment
Collaborator
There was a problem hiding this comment.
Simple and correct.
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.
Fixes #1979
TUI 输入
/的补全弹窗中,中文技能别名行(/前端设计、/深度研究等)右侧描述列与英文行不对齐。原因:
commandsmemo 的填充用String.length+padEnd(),按 code unit 而非终端列宽计算。中文占 2 列但按 1 列算,中文行渲染宽度超出填充宽度,右侧描述被顶出 2~6 列。改动:改用
Bun.stringWidth计算列宽后填充(同文件 extmark 偏移已在用这个宽度函数)。Before / after(数字为各行描述起始列):
验证:
bun run build:local构建后在 TUI 输入/,中英文行描述列已对齐tsgo --noEmit0 errors;oxlint 无新增告警;autocomplete-detect 测试 25/25 通过exactSubmitOption与 fuzzysort 均对display.trimEnd()比较,填充宽度变化不影响命令匹配