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

Method wrappedLineNumber

texteditor/nav.go:46–51  ·  view source on GitHub ↗

wrappedLineNumber returns the wrapped line number (span index) and rune index within that span of the given character position within line in position, and false if out of range (last valid position returned in that case -- still usable).

(pos lexer.Pos)

Source from the content-addressed store, hash-verified

44// within that span of the given character position within line in position,
45// and false if out of range (last valid position returned in that case -- still usable).
46func (ed *Editor) wrappedLineNumber(pos lexer.Pos) (si, ri int, ok bool) {
47 if pos.Ln >= len(ed.renders) {
48 return 0, 0, false
49 }
50 return ed.renders[pos.Ln].RuneSpanPos(pos.Ch)
51}
52
53// setCursor sets a new cursor position, enforcing it in range.
54// This is the main final pathway for all cursor movement.

Callers 7

setCursorColumnMethod · 0.95
cursorDownMethod · 0.95
cursorUpMethod · 0.95
cursorStartLineMethod · 0.95
cursorEndLineMethod · 0.95
cursorKillMethod · 0.95
renderRegionBoxStyleMethod · 0.95

Calls 1

RuneSpanPosMethod · 0.80

Tested by

no test coverage detected