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

Method cursorForward

texteditor/nav.go:191–209  ·  view source on GitHub ↗

cursorForward moves the cursor forward

(steps int)

Source from the content-addressed store, hash-verified

189
190// cursorForward moves the cursor forward
191func (ed *Editor) cursorForward(steps int) {
192 ed.validateCursor()
193 org := ed.CursorPos
194 for i := 0; i < steps; i++ {
195 ed.CursorPos.Ch++
196 if ed.CursorPos.Ch > ed.Buffer.LineLen(ed.CursorPos.Ln) {
197 if ed.CursorPos.Ln < ed.NumLines-1 {
198 ed.CursorPos.Ch = 0
199 ed.CursorPos.Ln++
200 } else {
201 ed.CursorPos.Ch = ed.Buffer.LineLen(ed.CursorPos.Ln)
202 }
203 }
204 }
205 ed.setCursorColumn(ed.CursorPos)
206 ed.SetCursorShow(ed.CursorPos)
207 ed.cursorSelect(org)
208 ed.NeedsRender()
209}
210
211// cursorForwardWord moves the cursor forward by words
212func (ed *Editor) cursorForwardWord(steps int) {

Callers 3

cursorDeleteMethod · 0.95
cursorKillMethod · 0.95
keyInputMethod · 0.95

Calls 6

validateCursorMethod · 0.95
setCursorColumnMethod · 0.95
SetCursorShowMethod · 0.95
cursorSelectMethod · 0.95
LineLenMethod · 0.80
NeedsRenderMethod · 0.80

Tested by

no test coverage detected