Skip to content

Conversation

@aymanbagabas
Copy link
Member

This commit exposes the MoveToBegin and MoveToEnd methods in the textarea package, allowing users to programmatically move the cursor to the beginning or end of the input text.

This commit exposes the MoveToBegin and MoveToEnd methods in the
textarea package, allowing users to programmatically move the cursor
to the beginning or end of the input text.
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR exposes two new public methods (MoveToBegin and MoveToEnd) on the Model to allow programmatic cursor movement, and updates internal calls to use these methods.

  • Renames moveToBeginMoveToBegin and moveToEndMoveToEnd and updates their comments.
  • Updates all internal invocations in Update to use the new exported methods.
Comments suppressed due to low confidence (2)

textarea/textarea.go:986

  • There aren’t any unit tests covering the newly exported MoveToBegin and MoveToEnd methods. Adding tests will ensure correct behavior and prevent regressions.
// MoveToBegin moves the cursor to the beginning of the input.

textarea/textarea.go:994

  • If m.value can ever be empty, len(m.value)-1 will underflow, setting m.row to -1. Consider guarding against an empty value slice before setting the row.
	m.row = len(m.value) - 1

@aymanbagabas aymanbagabas merged commit 696244a into v2-exp Jul 10, 2025
22 checks passed
@aymanbagabas aymanbagabas deleted the v2-textarea-moveto branch July 10, 2025 13:34
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.

5 participants