Skip to content

Commit

Permalink
add other editor types from orig
Browse files Browse the repository at this point in the history
  • Loading branch information
rcoreilly committed Feb 19, 2025
1 parent ebf378c commit 9e6dc3f
Show file tree
Hide file tree
Showing 6 changed files with 1,004 additions and 1 deletion.
16 changes: 16 additions & 0 deletions text/lines/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,22 @@ func (ls *Lines) InsertText(st textpos.Pos, text []rune) *textpos.Edit {
return tbe
}

// InsertTextLines 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.
// Calls sendInput to send an Input event to views, so they update.
func (ls *Lines) InsertTextLines(st textpos.Pos, text [][]rune) *textpos.Edit {
ls.Lock()
ls.fileModCheck()
tbe := ls.insertTextImpl(st, text)
if tbe != nil && ls.Autosave {
go ls.autoSave()
}
ls.Unlock()
ls.sendInput()
return tbe
}

// InsertTextRect inserts a rectangle of text defined in given Edit record,
// (e.g., from RegionRect or DeleteRect).
// Returns a copy of the Edit record with an updated timestamp.
Expand Down
Loading

0 comments on commit 9e6dc3f

Please sign in to comment.