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

Method cursorEndLine

texteditor/nav.go:530–558  ·  view source on GitHub ↗

cursorEndLine moves the cursor to the end of the text

()

Source from the content-addressed store, hash-verified

528
529// cursorEndLine moves the cursor to the end of the text
530func (ed *Editor) cursorEndLine() {
531 ed.validateCursor()
532 org := ed.CursorPos
533 pos := ed.CursorPos
534
535 gotwrap := false
536 if wln := ed.wrappedLines(pos.Ln); wln > 1 {
537 si, ri, _ := ed.wrappedLineNumber(pos)
538 ri = len(ed.renders[pos.Ln].Spans[si].Text) - 1
539 nwc, _ := ed.renders[pos.Ln].SpanPosToRuneIndex(si, ri)
540 if si == len(ed.renders[pos.Ln].Spans)-1 { // last span
541 ri++
542 nwc++
543 }
544 ed.cursorColumn = ri
545 pos.Ch = nwc
546 ed.CursorPos = pos
547 gotwrap = true
548 }
549 if !gotwrap {
550 ed.CursorPos.Ch = ed.Buffer.LineLen(ed.CursorPos.Ln)
551 ed.cursorColumn = ed.CursorPos.Ch
552 }
553 ed.setCursor(ed.CursorPos)
554 ed.scrollCursorToRight()
555 ed.renderCursor(true)
556 ed.cursorSelect(org)
557 ed.NeedsRender()
558}
559
560// cursorEndDoc moves the cursor to the end of the text, updating selection if
561// select mode is active

Callers 2

cursorKillMethod · 0.95
keyInputMethod · 0.95

Calls 10

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

Tested by

no test coverage detected