Repository navigation
Fixed choice-dialog flicker from resize-triggered reflow - #175
Merged
Merged
Conversation
…Claude's response text re-wrapped to a slightly different width after the dialog first appeared Showing a choice menu resizes the terminal to fit ChoiceMenuPanel, which makes Claude's Ink renderer re-wrap the dialog at the new column width. The reflowed variant was previously applied to the model immediately, triggering another resize, another reflow, and so on. detectChoiceMenu now requires a replacement candidate to be confirmed on two consecutive polls before it replaces the currently active menu, so a one-off reflow never causes the destabilizing resize that produced it. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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
ChoiceMenuPanelresizes the terminal to fit itself. That resize makes Claude Code's Ink renderer re-wrap the same dialog at the new column width (confirmed against the existinggit-commit-bash-dialog/git-commit-bash-dialog-narrowfixtures, where only one option's wrapped text differs). The controller applied any detected difference immediately, so the reflowed variant replaced the menu just shown, triggering another resize → another reflow → loop. (Scrollback/history-buffer access was not the issue —detectChoiceMenuonly ever needs the live viewport, which was already read under JediTerm's buffer lock.)ClaudeSessionControllernow requires a replacement candidate that differs from the currently active menu to be seen on two consecutive polls before it replaces the active menu. A first-time show (no menu currently active) is still applied immediately — only replacing an already-shown menu is debounced. Since withholding the replacement prevents the resize that caused the divergence, the screen naturally reverts to the original menu on the next poll for one-off reflow artifacts, while genuinely new dialogs still get applied once confirmed.Test plan
git-commit-bash-dialog/-narrowdialog text (confirmed failing before the fix, passing after)mvn test— full suite greenmvn package— full build succeeds🤖 Generated with Claude Code