修复提示输入的换行、光标定位与 busy 状态显示#171
Merged
Merged
Conversation
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.
变更
>。statusLine时立即显示 spinner,避免首次提交后输入框上方空白。实现细节
src/ui/hooks/cursor.ts改为使用 Ink 7 的useCursor()和useBoxMetrics(),不再 patchstdout.write或手动写入上下移动光标的 ANSI 序列。{ rowsUp, column }调整为基于输入区域的{ row, column },再结合 Ink 测量到的输入框绝对位置计算最终{ x, y }。PromptInput使用固定的 prompt 前缀宽度计算输入内容宽度,并通过wrap="hard"让实时输入、换行边界和提交后回显保持一致。App向PromptInput传入cursorLayoutKey,将 status、视图、消息数量、最后一条消息、权限/问题提示等会改变输入框纵向位置的状态纳入布局 key,防止复用旧光标坐标。StatusLine独立渲染 busy spinner;即使 status 文本为空,只要 busy 就会显示 spinner。验证
npm run typechecknpm run lintnpm run format:check -- src/ui/views/App.tsx src/ui/views/PromptInput.tsx src/ui/hooks/cursor.ts src/ui/hooks/index.tsnpm run test:single -- src/tests/prompt-input-keys.test.ts