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

Method cursorStartLine

texteditor/nav.go:485–512  ·  view source on GitHub ↗

cursorStartLine moves the cursor to the start of the line, updating selection if select mode is active

()

Source from the content-addressed store, hash-verified

483// cursorStartLine moves the cursor to the start of the line, updating selection
484// if select mode is active
485func (ed *Editor) cursorStartLine() {
486 ed.validateCursor()
487 org := ed.CursorPos
488 pos := ed.CursorPos
489
490 gotwrap := false
491 if wln := ed.wrappedLines(pos.Ln); wln > 1 {
492 si, ri, _ := ed.wrappedLineNumber(pos)
493 if si > 0 {
494 ri = 0
495 nwc, _ := ed.renders[pos.Ln].SpanPosToRuneIndex(si, ri)
496 pos.Ch = nwc
497 ed.CursorPos = pos
498 ed.cursorColumn = ri
499 gotwrap = true
500 }
501 }
502 if !gotwrap {
503 ed.CursorPos.Ch = 0
504 ed.cursorColumn = ed.CursorPos.Ch
505 }
506 // fmt.Printf("sol cursorcol: %v\n", ed.CursorCol)
507 ed.setCursor(ed.CursorPos)
508 ed.scrollCursorToRight()
509 ed.renderCursor(true)
510 ed.cursorSelect(org)
511 ed.NeedsRender()
512}
513
514// CursorStartDoc moves the cursor to the start of the text, updating selection
515// if select mode is active

Callers 1

keyInputMethod · 0.95

Calls 9

validateCursorMethod · 0.95
wrappedLinesMethod · 0.95
wrappedLineNumberMethod · 0.95
setCursorMethod · 0.95
scrollCursorToRightMethod · 0.95
renderCursorMethod · 0.95
cursorSelectMethod · 0.95
SpanPosToRuneIndexMethod · 0.80
NeedsRenderMethod · 0.80

Tested by

no test coverage detected