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

Method cursorBackward

core/textfield.go:659–673  ·  view source on GitHub ↗

cursorBackward moves the cursor backward

(steps int)

Source from the content-addressed store, hash-verified

657
658// cursorBackward moves the cursor backward
659func (tf *TextField) cursorBackward(steps int) {
660 tf.cursorPos -= steps
661 if tf.cursorPos < 0 {
662 tf.cursorPos = 0
663 }
664 if tf.cursorPos <= tf.startPos {
665 dec := min(tf.startPos, 8)
666 tf.startPos -= dec
667 }
668 tf.cursorLine, _, _ = tf.renderAll.RuneSpanPos(tf.cursorPos)
669 if tf.selectMode {
670 tf.selectRegionUpdate(tf.cursorPos)
671 }
672 tf.NeedsRender()
673}
674
675// cursorBackwardWord moves the cursor backward by words
676func (tf *TextField) cursorBackwardWord(steps int) {

Callers 2

cursorBackspaceMethod · 0.95
handleKeyEventsMethod · 0.95

Calls 3

selectRegionUpdateMethod · 0.95
RuneSpanPosMethod · 0.80
NeedsRenderMethod · 0.80

Tested by

no test coverage detected