Skip to content

Fix cursor navigation in wrapped editor lines#144

Merged
shellicar merged 2 commits intomainfrom
fix/editor-cursor-wrapped-lines
Mar 28, 2026
Merged

Fix cursor navigation in wrapped editor lines#144
shellicar merged 2 commits intomainfrom
fix/editor-cursor-wrapped-lines

Conversation

@shellicar
Copy link
Copy Markdown
Owner

Summary

  • Up/Down arrows navigate by terminal row within wrapped lines
  • Cursor column wraps correctly within the current terminal row
  • Fix coordinate mismatch between editor lines and terminal rows in sticky zone

Closes #135

Co-Authored-By: Claude noreply@anthropic.com

@shellicar shellicar added this to the 1.0 milestone Mar 28, 2026
@shellicar shellicar added the bug Something isn't working label Mar 28, 2026
@shellicar shellicar self-assigned this Mar 28, 2026
@shellicar shellicar enabled auto-merge (squash) March 28, 2026 13:27
Copy link
Copy Markdown
Collaborator

@bananabot9000 bananabot9000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. The wrap-aware cursor navigation logic in moveUp/moveDown is correct -- subRow calculation, cross-line boundary handling, prefix width accounting all check out. terminal.ts simplification (editorScreenLines - cursorRow - 1 and cursorCol % columns) is a nice cleanup.

Cleanup notes (non-blocking):

  • Prompt string construction in ClaudeCli.ts is duplicated between up/down cases and likely duplicated from wherever the prompt is originally built. A getPromptWidth() helper would prevent drift.
  • byteOffsetAtVisualWidth returns a code unit offset, not a byte offset. Minor naming inaccuracy.
  • The duplicated variable naming (busyUp/busyDown, colsUp/colsDown) could be shared -- both cases use the same values.

Manually verified by author. Ship it.

@shellicar shellicar merged commit 61be23c into main Mar 28, 2026
4 checks passed
@shellicar shellicar deleted the fix/editor-cursor-wrapped-lines branch March 28, 2026 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Editor cursor mispositioned when long wrapped lines are present

2 participants