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

Method DeleteText

texteditor/buffer.go:703–716  ·  view source on GitHub ↗

DeleteText is the primary method for deleting text from the buffer. It deletes region of text between start and end positions, optionally signaling views after text lines have been updated. Sets the timestamp on resulting Edit to now. An Undo record is automatically saved depending on Undo.Off setti

(st, ed lexer.Pos, signal bool)

Source from the content-addressed store, hash-verified

701// Sets the timestamp on resulting Edit to now.
702// An Undo record is automatically saved depending on Undo.Off setting.
703func (tb *Buffer) DeleteText(st, ed lexer.Pos, signal bool) *text.Edit {
704 tb.FileModCheck()
705 tbe := tb.Lines.DeleteText(st, ed)
706 if tbe == nil {
707 return tbe
708 }
709 if signal {
710 tb.signalEditors(bufferDelete, tbe)
711 }
712 if tb.Autosave {
713 go tb.autoSave()
714 }
715 return tbe
716}
717
718// deleteTextRect deletes rectangular region of text between start, end
719// defining the upper-left and lower-right corners of a rectangle.

Callers 8

completeTextMethod · 0.95
applyDiffMethod · 0.45
cursorBackspaceMethod · 0.45
cursorDeleteMethod · 0.45
cursorBackspaceWordMethod · 0.45
cursorDeleteWordMethod · 0.45
cursorKillMethod · 0.45
deleteSelectionMethod · 0.45

Calls 3

FileModCheckMethod · 0.95
signalEditorsMethod · 0.95
autoSaveMethod · 0.95

Tested by

no test coverage detected