Skip to content

Keep the cursor visible when a wrapped input line scrolls - #2181

Open
Boulea7 wants to merge 1 commit into
prompt-toolkit:mainfrom
Boulea7:fix/2071-visible-cursor-at-wrap
Open

Boulea7 wants to merge 1 commit into
prompt-toolkit:mainfrom
Boulea7:fix/2071-visible-cursor-at-wrap

Conversation

@Boulea7

@Boulea7 Boulea7 commented Dec 3, 2026

Copy link
Copy Markdown

Refs #2071.

In a one-row wrapped input window, the cursor can land on the next visual row while the text before it still fits on the previous row. The window then scrolls to an earlier row and the renderer puts the cursor at the screen origin. Include the character under the cursor when choosing the visible rows.

This follows yuxino’s cursor measurement in #2174. gyanu2507 also identified the exact-wrap boundary in #2084.

Added layout regressions for a space at the wrap, the insertion point at the end of a line, a wide character and a continuation prefix. In a real macOS tmux terminal, both 3.0.53 and the upstream base misplaced the cursor while typing and when resizing to 28 and 21 columns. The candidate kept the cursor in the input row in all 417 inspected frames. Each session returned the complete input. The Python test suite passed 160 tests.

Tightly packed wide characters at odd widths can still make the height estimate undercount rows when each wrap leaves a cell unused.

Codex assisted with development and verification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant