fix(tui): preserve scrollback when closing editor-replacement dialogs - #2414
fix(tui): preserve scrollback when closing editor-replacement dialogs#2414mangeshraut712 wants to merge 1 commit into
Conversation
🦋 Changeset detectedLatest commit: ca8cd91 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Final verification (local)Verdict: VERIFIED — ready for review/merge from the local evidence below. GitHub Actions checks had not reported on this fork branch yet at verification time.
No further code changes planned on this PR unless review asks. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3451e886f0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // Mirrors KimiTUI.restoreEditor without constructing the full TUI host. | ||
| const restoreEditor = (): void => { |
There was a problem hiding this comment.
Drive the real restoreEditor in the regression test
Because this test defines a local copy of KimiTUI.restoreEditor instead of invoking the production method, it will keep passing if the real restoreEditor later drops { clearScrollback: false } or changes its overflow logic; the new standalone file also bypasses the repo preference to extend the existing test for the relevant module. Please move this coverage to an existing KimiTUI/TUI test and call the real method rather than a mirror.
AGENTS.md reference: AGENTS.md:L60-L60
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Addressed in 63fd1da:
- Deleted the standalone mirrored
restore-editor-scrollback.test.ts - Moved coverage into
kimi-tui-startup.test.ts - Tests now construct real
KimiTUIand call productionrestoreEditor()(overflow / fits / tmux cases)
Replace the mirrored restoreEditor helper with coverage that constructs KimiTUI and calls the production method, addressing Codex P2 on MoonshotAI#2414. Co-authored-by: Cursor <cursoragent@cursor.com>
Update — Codex P2 fixedFollow-up commit Re-verified locally: focused restoreEditor + custom-editor scrollback tests pass. |
Final verification (post-Codex-P2)
Ready for maintainer review. Manual smoke (permission approve / AskUserQuestion / slash-menu with scrolled scrollback) still useful if a reviewer has a TTY. |
Replace the mirrored restoreEditor helper with coverage that constructs KimiTUI and calls the production method, addressing Codex P2 on MoonshotAI#2414. Co-authored-by: Cursor <cursoragent@cursor.com>
Closing editor-replacement dialogs cleared TUI scrollback because restoreEditor rebuilt the viewport without restoring prior history. Preserve scrollback across restore and cover it with a regression test that drives the real restoreEditor path.
63fd1da to
ca8cd91
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ca8cd916cd
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| @@ -0,0 +1,5 @@ | |||
| --- | |||
| "@moonshot-ai/pi-tui": patch | |||
There was a problem hiding this comment.
Drop the private pi-tui changeset
This changeset targets @moonshot-ai/pi-tui, but the repo's changeset instructions say release changesets should only select @moonshot-ai/kimi-code or @moonshot-ai/kimi-code-sdk (.changeset/README.md:149), and internal-package fixes that affect the CLI should be represented by the affected publishable package (.changeset/README.md:150). Since this PR already adds a @moonshot-ai/kimi-code changeset for the user-visible behavior, leaving this file makes the release metadata include a private internal package instead of staying limited to publishable artifacts, so please remove it.
Useful? React with 👍 / 👎.
Summary
restoreEditorpaths) forced a full redraw that includedESC[3J, wiping terminal scrollback and yanking anyone who had scrolled up to read history (TUI scroll position resets to top after approving a tool permission prompt #2296).requestRender(true, { clearScrollback: false })in pi-tui so callers can re-anchor the live viewport without clearing scrollback; wire it intorestoreEditorand slash-menu close.requestRender(true)still clears scrollback, matching prior behavior for width/height and other forced redraws.Test plan
pnpm --filter @moonshot-ai/pi-tui test(716 pass), including new “forced redraw can skip clearing terminal scrollback”KimiTUI.restoreEditor()coverage inkimi-tui-startup.test.ts+custom-editor.test.tsscrollback casesResolves #2296