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

Method Copy

texteditor/select.go:332–346  ·  view source on GitHub ↗

Copy copies any selected text to the clipboard, and returns that text, optionally resetting the current selection

(reset bool)

Source from the content-addressed store, hash-verified

330// Copy copies any selected text to the clipboard, and returns that text,
331// optionally resetting the current selection
332func (ed *Editor) Copy(reset bool) *text.Edit {
333 tbe := ed.Selection()
334 if tbe == nil {
335 return nil
336 }
337 cb := tbe.ToBytes()
338 addEditorClipboardHistory(cb)
339 ed.Clipboard().Write(mimedata.NewTextBytes(cb))
340 if reset {
341 ed.SelectReset()
342 }
343 ed.savePosHistory(ed.CursorPos)
344 ed.NeedsRender()
345 return tbe
346}
347
348// Paste inserts text from the clipboard at current cursor position
349func (ed *Editor) Paste() {

Callers 2

keyInputMethod · 0.95
contextMenuMethod · 0.95

Calls 9

SelectionMethod · 0.95
SelectResetMethod · 0.95
savePosHistoryMethod · 0.95
NewTextBytesFunction · 0.92
ToBytesMethod · 0.80
NeedsRenderMethod · 0.80
WriteMethod · 0.65
ClipboardMethod · 0.65

Tested by

no test coverage detected