MCPcopy Create free account
hub / github.com/cogentcore/core / cursorForward

Method cursorForward

core/textfield.go:591–605  ·  view source on GitHub ↗

Cursor Navigation cursorForward moves the cursor forward

(steps int)

Source from the content-addressed store, hash-verified

589
590// cursorForward moves the cursor forward
591func (tf *TextField) cursorForward(steps int) {
592 tf.cursorPos += steps
593 if tf.cursorPos > len(tf.editText) {
594 tf.cursorPos = len(tf.editText)
595 }
596 if tf.cursorPos > tf.endPos {
597 inc := tf.cursorPos - tf.endPos
598 tf.endPos += inc
599 }
600 tf.cursorLine, _, _ = tf.renderAll.RuneSpanPos(tf.cursorPos)
601 if tf.selectMode {
602 tf.selectRegionUpdate(tf.cursorPos)
603 }
604 tf.NeedsRender()
605}
606
607// cursorForwardWord moves the cursor forward by words
608func (tf *TextField) cursorForwardWord(steps int) {

Callers 2

insertAtCursorMethod · 0.95
handleKeyEventsMethod · 0.95

Calls 3

selectRegionUpdateMethod · 0.95
RuneSpanPosMethod · 0.80
NeedsRenderMethod · 0.80

Tested by

no test coverage detected