insertText is the primary method for inserting text into the buffer. It inserts new text at given starting position, optionally signaling views after text has been inserted. Sets the timestamp on resulting Edit to now. An Undo record is automatically saved depending on Undo.Off setting.
(st lexer.Pos, text []byte, signal bool)
| 739 | // views after text has been inserted. Sets the timestamp on resulting Edit to now. |
| 740 | // An Undo record is automatically saved depending on Undo.Off setting. |
| 741 | func (tb *Buffer) insertText(st lexer.Pos, text []byte, signal bool) *text.Edit { |
| 742 | tb.FileModCheck() // will just revert changes if shouldn't have changed |
| 743 | tbe := tb.Lines.InsertText(st, text) |
| 744 | if tbe == nil { |
| 745 | return tbe |
| 746 | } |
| 747 | if signal { |
| 748 | tb.signalEditors(bufferInsert, tbe) |
| 749 | } |
| 750 | if tb.Autosave { |
| 751 | go tb.autoSave() |
| 752 | } |
| 753 | return tbe |
| 754 | } |
| 755 | |
| 756 | // insertTextRect inserts a rectangle of text defined in given text.Edit record, |
| 757 | // (e.g., from RegionRect or DeleteRect), optionally signaling |
no test coverage detected