fix(cli): account for wrapped working line in composer cursor offset - #7768
Open
innocarpe wants to merge 1 commit into
Open
fix(cli): account for wrapped working line in composer cursor offset#7768innocarpe wants to merge 1 commit into
innocarpe wants to merge 1 commit into
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.
Summary
Fix #7537 (TUI composer cursor drifts outside the input box on narrow terminals while a turn is running):
Root cause:
View()counted the working (spinner) line as exactly 1 row (rowsAboveBox++), but renders it withwrapStatusLine(working, boxW)— which wraps to 2+ rows on narrow terminals. The composer cursor math (cur.Y += viewport.Height() + rowsAboveBox + 1) then placed the cursor N−1 rows above the actual input box. The height budget (bottomRows/computeStatusLineCount) already counted wrapped rows — onlyrowsAboveBoxwas wrong.Fix (3 hunks, no rendering change):
workingLineRows(working, width)— wrapped-row count via the samewrapStatusLine/width the bottomRows path usesView()uses it instead of the hardcoded 1;computeStatusLineCountnow shares the helper (behavior identical)composer_selection.goverified clean (textarea-internal viewport only)Tests (headless, narrow-terminal):
TestWorkingLineRowsWrapAccounting(pure-helper table) +TestWorkingLineWrapKeepsComposerCursorInBox— asserts cursor Y lands inside the composer box with a 2+ row wrapped working line; fails pre-fix, passes post-fix.Issues
Fixes #7537
Verification
go test ./internal/cli/— full suite passgo vet/gofmt -l/go build ./cmd/reasonix— cleanDocumentation impact
Documentation-impact: none - cursor positioning; no docs affected.
Cache impact
Cache-impact: none - TUI rendering only; no prompt/tool surface touched.
Cache-guard: N/A
System-prompt-review: N/A