ReplaceText does DeleteText for given region, and then InsertText at given position (typically same as delSt but not necessarily), optionally emitting a signal after the insert. if matchCase is true, then the lexer.MatchCase function is called to match the case (upper / lower) of the new inserted te
(delSt, delEd, insPos lexer.Pos, insTxt string, signal, matchCase bool)
| 787 | // case (upper / lower) of the new inserted text to that of the text being replaced. |
| 788 | // returns the text.Edit for the inserted text. |
| 789 | func (tb *Buffer) ReplaceText(delSt, delEd, insPos lexer.Pos, insTxt string, signal, matchCase bool) *text.Edit { |
| 790 | tbe := tb.Lines.ReplaceText(delSt, delEd, insPos, insTxt, matchCase) |
| 791 | if tbe == nil { |
| 792 | return tbe |
| 793 | } |
| 794 | if signal { |
| 795 | tb.signalMods() // todo: could be more specific? |
| 796 | } |
| 797 | if tb.Autosave { |
| 798 | go tb.autoSave() |
| 799 | } |
| 800 | return tbe |
| 801 | } |
| 802 | |
| 803 | // savePosHistory saves the cursor position in history stack of cursor positions -- |
| 804 | // tracks across views -- returns false if position was on same line as last one saved |
no test coverage detected