Repository navigation
Conversation
Allow downward navigation to reach the end-of-line cursor position instead of clamping to the last rune. This makes the reserved cursor row reachable for exact-width content without changing wrapping or remembered display columns. Add key-message regressions for exact-width, short, overflowing, word-wrapped, spaced, and wide-rune content, including reverse navigation and buffer boundaries. Refs charmbracelet#887.
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.
Let Down reach the reserved cursor row after an exact-width line, so navigation no longer gets stuck. Preserve wrapping and remembered display columns.
Refs #887.
Validation limits: Windows amd64, Go 1.27.1 only. Configured lint reports 27 unchanged CRLF formatting findings (none in changed files); race checks are unavailable without CGO/a C compiler. No interactive-terminal or cross-platform validation.
Root cause and observed cursor states
The downward probe stopped at
len(line)-1, so it could not reach the end-of-line cursor position on the reserved wrapped row. Allowinglen(line)fixes the stall without changingwrap(),LineInfo(), or horizontal-column restoration.Deterministic Model observations, using an effective content width of 20 with prompt and line numbers disabled. The value is 20 ASCII
acharacters, a newline, thenabcdefghijklmnop. Positions below are zero-based(logical line, rune column):The intermediate
(0,20)is the preserved cursor-only wrapped row. The corresponding real cursor(X,Y)positions are(7,0),(0,1), and(7,2). This is captured Model behavior, not an interactive-terminal screenshot or human visual review.Regression coverage and local validation
The new key-message test fails in six cases before the fix and passes all nine afterward. It covers exact-width lines, repeated wraps, spaces, CJK/mixed-width runes, remembered display columns, Up reversibility, and buffer boundaries. Short-line, over-width, and word-wrap controls pass before and after; existing view expectations are unchanged.
Passed with session-local Go 1.27.1,
GOMAXPROCS=2, and package parallelism limited to one:gofmt -lreports no changes for either modified file. The pinned golangci-lint v2.13.1 run used the existing config and one worker; all 27 reported files match the base and have CRLF checkout line endings. No lint exclusions, unrelated formatting changes, or dependency changes were made.CONTRIBUTING.md.