MCPcopy
hub / github.com/mathaou/termdbms / setCursor

Method setCursor

tuiutil/textinput.go:217–226  ·  view source on GitHub ↗

setCursor moves the cursor to the given position and returns whether or not the cursor blink should be reset. If the position is out of bounds the cursor will be moved to the start or end accordingly.

(pos int)

Source from the content-addressed store, hash-verified

215// the cursor blink should be reset. If the position is out of bounds the
216// cursor will be moved to the start or end accordingly.
217func (m *TextInputModel) setCursor(pos int) bool {
218 m.pos = Clamp(pos, 0, len(m.value))
219 m.handleOverflow()
220
221 // Show the cursor unless it's been explicitly hidden
222 m.blink = m.cursorMode == CursorHide
223
224 // Reset cursor blink if necessary
225 return m.cursorMode == CursorBlink
226}
227
228// CursorStart moves the cursor to the start of the input field.
229func (m *TextInputModel) CursorStart() {

Callers 13

SetValueMethod · 0.95
SetCursorMethod · 0.95
cursorStartMethod · 0.95
cursorEndMethod · 0.95
ResetMethod · 0.95
handlePasteMethod · 0.95
deleteBeforeCursorMethod · 0.95
deleteAfterCursorMethod · 0.95
deleteWordLeftMethod · 0.95
deleteWordRightMethod · 0.95
wordLeftMethod · 0.95
wordRightMethod · 0.95

Calls 2

handleOverflowMethod · 0.95
ClampFunction · 0.85

Tested by

no test coverage detected