Skip to content

Commit 696244a

Browse files
authored
feat(textarea): expose MoveToBegin and MoveToEnd methods (#809)
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.
1 parent 56bbc4a commit 696244a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

textarea/textarea.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -983,14 +983,14 @@ func (m Model) Width() int {
983983
return m.width
984984
}
985985

986-
// moveToBegin moves the cursor to the beginning of the input.
987-
func (m *Model) moveToBegin() {
986+
// MoveToBegin moves the cursor to the beginning of the input.
987+
func (m *Model) MoveToBegin() {
988988
m.row = 0
989989
m.SetCursorColumn(0)
990990
}
991991

992-
// moveToEnd moves the cursor to the end of the input.
993-
func (m *Model) moveToEnd() {
992+
// MoveToEnd moves the cursor to the end of the input.
993+
func (m *Model) MoveToEnd() {
994994
m.row = len(m.value) - 1
995995
m.SetCursorColumn(len(m.value[m.row]))
996996
}
@@ -1170,9 +1170,9 @@ func (m Model) Update(msg tea.Msg) (Model, tea.Cmd) {
11701170
case key.Matches(msg, m.KeyMap.WordBackward):
11711171
m.wordLeft()
11721172
case key.Matches(msg, m.KeyMap.InputBegin):
1173-
m.moveToBegin()
1173+
m.MoveToBegin()
11741174
case key.Matches(msg, m.KeyMap.InputEnd):
1175-
m.moveToEnd()
1175+
m.MoveToEnd()
11761176
case key.Matches(msg, m.KeyMap.LowercaseWordForward):
11771177
m.lowercaseRight()
11781178
case key.Matches(msg, m.KeyMap.UppercaseWordForward):

0 commit comments

Comments
 (0)