Gemini CLI fix: ExpandableText truncation no longer splits emoji surrogate pairs

Grove-ovo · ghdev · 2026-09-13

Grove-ovo 向 gemini-cli 提交 PR #29303,修复 ExpandableText 组件用 UTF-16 code-unit 索引截断文本时的 bug:当截断边界落在 emoji 的高代理项上时,Ink 收到未配对代理并静默丢字符,如 aaaa😀tail 在 maxWidth 5 下渲染成 aaaa...。修复方案:所有截断路径改用 code points 度量与切片,复用 textUtils.ts 的 cpLen/cpSlice,并在 UTF-16 偏移与码点索引间转换;调用点 SuggestionsDisplay 和 InputPrompt 同步改用 cpLen,边界条件从 >= 改为 >,避免恰好等宽的标签出现无意义的展开箭头。纯 ASCII 标签走快速路径,输出字节级不变。作者另指出两个遗留同类问题已单独开 issue。

Original post →

More from coding & agent

coding & agent channel →