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

Method InsertSpan

paint/text.go:66–75  ·  view source on GitHub ↗

InsertSpan inserts a new span at given index

(at int, ns *Span)

Source from the content-addressed store, hash-verified

64
65// InsertSpan inserts a new span at given index
66func (tr *Text) InsertSpan(at int, ns *Span) {
67 sz := len(tr.Spans)
68 tr.Spans = append(tr.Spans, Span{})
69 if at > sz-1 {
70 tr.Spans[sz] = *ns
71 return
72 }
73 copy(tr.Spans[at+1:], tr.Spans[at:])
74 tr.Spans[at] = *ns
75}
76
77// Render does text rendering into given image, within given bounds, at given
78// absolute position offset (specifying position of text baseline) -- any

Callers 1

LayoutStdLRMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected