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

Method insertText

texteditor/text/lines.go:959–963  ·  view source on GitHub ↗

insertText is the primary method for inserting text, at given starting position. Sets the timestamp on resulting Edit to now. An Undo record is automatically saved depending on Undo.Off setting.

(st lexer.Pos, text []byte)

Source from the content-addressed store, hash-verified

957// at given starting position. Sets the timestamp on resulting Edit to now.
958// An Undo record is automatically saved depending on Undo.Off setting.
959func (ls *Lines) insertText(st lexer.Pos, text []byte) *Edit {
960 tbe := ls.insertTextImpl(st, text)
961 ls.saveUndo(tbe)
962 return tbe
963}
964
965func (ls *Lines) insertTextImpl(st lexer.Pos, text []byte) *Edit {
966 if len(text) == 0 {

Callers 7

InsertTextMethod · 0.95
appendTextMarkupMethod · 0.95
appendTextLineMarkupMethod · 0.95
replaceTextMethod · 0.95
indentLineMethod · 0.95
commentRegionMethod · 0.95
patchFromBufferMethod · 0.95

Calls 2

insertTextImplMethod · 0.95
saveUndoMethod · 0.95

Tested by

no test coverage detected