1
0
mirror of https://github.com/rivo/tview.git synced 2025-05-01 13:48:49 +08:00

make cursor position modifiable from external packages

This commit is contained in:
DevHegemony 2023-10-01 12:14:27 -04:00
parent 9bc1d28d88
commit db2e247f91

View File

@ -278,6 +278,17 @@ func (i *InputField) SetFormAttributes(labelWidth int, labelColor, bgColor, fiel
return i
}
// GetCursorPos gets the current offset for cursor from start of field.
func (i *InputField) GetCursorPos() (pos int) {
return i.cursorPos
}
// SetCursorPos sets the current offset for cursor from start of field.
func (i *InputField) SetCursorPos(pos int) *InputField {
i.cursorPos = pos
return i
}
// SetFieldWidth sets the screen width of the input area. A value of 0 means
// extend as much as possible.
func (i *InputField) SetFieldWidth(width int) *InputField {