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

Method cursorUp

core/textfield.go:748–763  ·  view source on GitHub ↗

cursorUp moves the cursor up

(steps int)

Source from the content-addressed store, hash-verified

746
747// cursorUp moves the cursor up
748func (tf *TextField) cursorUp(steps int) {
749 if tf.numLines <= 1 {
750 return
751 }
752 if tf.cursorLine <= 0 {
753 return
754 }
755
756 _, ri, _ := tf.renderAll.RuneSpanPos(tf.cursorPos)
757 tf.cursorLine = max(tf.cursorLine-steps, 0)
758 tf.cursorPos, _ = tf.renderAll.SpanPosToRuneIndex(tf.cursorLine, ri)
759 if tf.selectMode {
760 tf.selectRegionUpdate(tf.cursorPos)
761 }
762 tf.NeedsRender()
763}
764
765// cursorStart moves the cursor to the start of the text, updating selection
766// if select mode is active.

Callers 1

handleKeyEventsMethod · 0.95

Calls 4

selectRegionUpdateMethod · 0.95
RuneSpanPosMethod · 0.80
SpanPosToRuneIndexMethod · 0.80
NeedsRenderMethod · 0.80

Tested by

no test coverage detected