Skip to content

fix(textarea): avoid phantom soft-wrap and unstick vertical cursor - #1017

Open
Solaris-star wants to merge 1 commit into
charmbracelet:mainfrom
Solaris-star:fix/887-textarea-exact-softwrap-cursor
Open

fix(textarea): avoid phantom soft-wrap and unstick vertical cursor#1017
Solaris-star wants to merge 1 commit into
charmbracelet:mainfrom
Solaris-star:fix/887-textarea-exact-softwrap-cursor

Conversation

@Solaris-star

Copy link
Copy Markdown

Summary

Fixes #887.

When a soft-wrapped line exactly filled the textarea width, wrap() used >= width and created a phantom blank line. Vertical navigation also stopped one display column early because setCursorLineRelative broke when offset >= CharWidth-1.

Changes

  • Use > width in the final wrap() width check so content that exactly fits does not spawn an extra line
  • Compare offset >= CharWidth when restoring the horizontal cursor column after vertical moves
  • Update TestView cursor expectations for exact-width lines
  • Add regression tests for phantom wrap lines and cursor-down from a full-width line

Test plan

  • go test ./textarea/

When a line exactly fills the textarea width, wrap() used >= and created
a phantom blank line. Vertical navigation also stopped one display column
early because setCursorLineRelative broke at CharWidth-1.

Fixes charmbracelet#887
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.

Cursor gets stuck when navigating up/down in textarea

1 participant