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

Method SetText

texteditor/text/lines.go:121–127  ·  view source on GitHub ↗

SetText sets the text to the given bytes (makes a copy). Pass nil to initialize an empty buffer.

(text []byte)

Source from the content-addressed store, hash-verified

119// SetText sets the text to the given bytes (makes a copy).
120// Pass nil to initialize an empty buffer.
121func (ls *Lines) SetText(text []byte) {
122 ls.Lock()
123 defer ls.Unlock()
124
125 ls.bytesToLines(text)
126 ls.initFromLineBytes()
127}
128
129// SetTextLines sets linesBytes from given lines of bytes, making a copy
130// and removing any trailing \r carriage returns, to standardize.

Callers 5

EditorFunction · 0.45
ContextMenuMethod · 0.45
DiffDirsMethod · 0.45
diffDirsAtMethod · 0.45
DiffVCSMethod · 0.45

Calls 4

bytesToLinesMethod · 0.95
initFromLineBytesMethod · 0.95
LockMethod · 0.65
UnlockMethod · 0.65

Tested by

no test coverage detected