mirror of
https://github.com/Maks1mS/bubbles.git
synced 2025-03-13 12:33:43 +03:00
Add method for returning cursor position in textinput
Previously, Cursor was a member on the model that did absolutely nothing.
This commit is contained in:
parent
74436326b9
commit
f016c31d83
@ -61,7 +61,6 @@ type Model struct {
|
||||
// General settings.
|
||||
Prompt string
|
||||
Placeholder string
|
||||
Cursor string
|
||||
BlinkSpeed time.Duration
|
||||
EchoMode EchoMode
|
||||
EchoCharacter rune
|
||||
@ -150,6 +149,11 @@ func (m Model) Value() string {
|
||||
return string(m.value)
|
||||
}
|
||||
|
||||
// Cursor returns the cursor position.
|
||||
func (m Model) Cursor() int {
|
||||
return m.pos
|
||||
}
|
||||
|
||||
// SetCursor moves the cursor to the given position. If the position is
|
||||
// out of bounds the cursor will be moved to the start or end accordingly.
|
||||
func (m *Model) SetCursor(pos int) {
|
||||
|
Loading…
Reference in New Issue
Block a user