Repository navigation
Conversation
The cursor anchor counted blank logical lines and treated the start of a wrapped line below the cursor as the anchor itself. Narrowing across a wrap boundary therefore moved the cursor one logical line down per drag tick (or left it on the wrong row), so later cursor-relative repaints landed off the prompt. Anchor by non-empty logical lines only: reflow drops blank rows, while non-empty lines keep their identity and order. Restore the cursor to the same logical line and column across every intermediate width. Regression test covers a scrolled-back grid through 80 to 40 and back. Refs Kuddev#1091.
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.
Result / 用户结果
When a terminal pane has a long scrollback and the user has scrolled away from the bottom, dragging the pane or window width through a soft-wrap boundary could leave the terminal cursor one logical line below the prompt. A TUI that repaints relative to the cursor (for example Claude Code) then drew its input box off the intended row and left stale rows below it.
This change keeps the cursor on the same logical line and column across every intermediate width of a drag, in both directions.
Part of #1091. The report also mentions scrollbar movement and occasional wheel-scroll glitches; those are not claimed as fixed here and still need native Windows/ConPTY verification.
Design / 设计边界
pebrel_terminal/src/grid/resize.rs.Gridreflow owns cursor placement; the app continues to only forward viewport geometry. No UI, settings, or persistence code changes.Grid/TermAPIs are unchanged.The previous anchor counted blank logical lines, whose number reflow does not preserve, and then treated the start row of a wrapped line below the cursor as the anchor itself. The new anchor counts only non-empty logical lines and locates the cursor's own line before restoring its column offset.
Evidence / 验证依据
cargo test -p pebrel_terminal— pass (408 library tests plus all integration targets).cargo test -p pebrel --bin pebrel --features gpui-shell -- resize— 9 passed.cargo test -p pebrel --bin pebrel --features gpui-shell -- reflow— 2 passed.cargo check -p pebrel --bin pebrel --features gpui-shell --tests --locked— pass.python3 scripts/check_architecture.py --base 76f74be1— pass; only existing tighten notices.cargo fmt --all -- --check— pass.cargo test -p pebrel --test file_line_budget— 2 passed.grid::tests::reflow_keeps_cursor_on_its_logical_line_while_scrolled_backbuilds 120 lines of output, scrolls back 30 rows, then resizes 80→40→80 one column at a time and asserts the cursor stays onL0118at column 10. It fails before the change at 69 columns (L0119) and passes after.Required Review / 必须确认
CONTRIBUTING.md,docs/architecture.md, anddocs/project-constraints.md.python3 scripts/check_architecture.py --base <PR-base-commit>passes; budgets were not inflated to fit the change.