From db2e247f91ec4186c81f62f4ca8d052736b1c8d9 Mon Sep 17 00:00:00 2001 From: DevHegemony Date: Sun, 1 Oct 2023 12:14:27 -0400 Subject: [PATCH] make cursor position modifiable from external packages --- inputfield.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/inputfield.go b/inputfield.go index 9118fbc1..69f5389b 100644 --- a/inputfield.go +++ b/inputfield.go @@ -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 {