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

Method cursorDown

core/textfield.go:730–745  ·  view source on GitHub ↗

cursorDown moves the cursor down

(steps int)

Source from the content-addressed store, hash-verified

728
729// cursorDown moves the cursor down
730func (tf *TextField) cursorDown(steps int) {
731 if tf.numLines <= 1 {
732 return
733 }
734 if tf.cursorLine >= tf.numLines-1 {
735 return
736 }
737
738 _, ri, _ := tf.renderAll.RuneSpanPos(tf.cursorPos)
739 tf.cursorLine = min(tf.cursorLine+steps, tf.numLines-1)
740 tf.cursorPos, _ = tf.renderAll.SpanPosToRuneIndex(tf.cursorLine, ri)
741 if tf.selectMode {
742 tf.selectRegionUpdate(tf.cursorPos)
743 }
744 tf.NeedsRender()
745}
746
747// cursorUp moves the cursor up
748func (tf *TextField) cursorUp(steps int) {

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