Conversation
The display refactor (b735972) copied displayLine into displayLineRefactored for the main render path but dropped the pending-wrap handling the original had for input landing exactly on the terminal's right edge. Since the copy is the per-keystroke path, typing past the right edge on the bottom row erased the edge glyph and wedged the redraw (scrolling a row per key). The two functions otherwise drifted as identical copies — inline-suggestion work had to patch both, and this fix had to patch only one. Collapse them into a single displayLine used by both the main refresh path (renderInputArea) and the transient-prompt redraw (RefreshTransient), and give it correct right-edge handling: skip clear-to-end-of-line in the terminal's pending-wrap state (it can erase the edge glyph), then force the wrap before later clear/cursor-movement sequences. Includes the PTY regression test from PR #112 by @rztaylor, which fails without the fix (input wedges at the right edge) and passes with it. Co-authored-by: rztaylor <rztaylor@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #117 +/- ##
==========================================
+ Coverage 39.33% 39.52% +0.18%
==========================================
Files 60 60
Lines 9610 9592 -18
==========================================
+ Hits 3780 3791 +11
+ Misses 5742 5713 -29
Partials 88 88 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Problem
Two issues, one root cause.
1. Right-edge redraw regression (still present on
master). When editable input lands exactly on the terminal's right edge while the prompt is on the bottom row, terminals leave the cursor in a pending-wrap state. The main render path still emitted clear-to-end-of-line there, erasing the edge glyph and wedging the redraw — typing past the edge scrolled a row per keypress or stalled. This is the bug PR #112 by @rztaylor fixed; that PR was closed without explanation and never merged. I confirmed the bug reproduces on currentmaster(the PR's regression test times out) and that the fix resolves it.2. Duplicated render functions. The display refactor (
b735972) copieddisplayLineintodisplayLineRefactoredfor the main render path but dropped the original's right-edge (lineCol == 0) handling — that dropped block is the regression above. The two functions then lived on as near-identical copies:displayLineRefactored(refresh.go) → main per-keystroke pathdisplayLine(engine.go) → onlyRefreshTransientThey had already drifted: the inline-suggestion work (#114) had to patch both, and #112 patched only one. A latent trap.
Fix
Collapse them into a single
displayLine, shared by both the main refresh path (renderInputArea) and the transient-prompt redraw (RefreshTransient), carrying correct right-edge handling:NewlineReturn) before any later clear/cursor-movement sequences.The transient path already appended its own
NewlineReturn, and the old legacydisplayLinealso emitted one at the right edge, so the newline count in that path is unchanged.Testing
go build,go vet, andgo test ./...all pass — full display suite (including transient/drift PTY tests) green, no regressions.Supersedes #112.