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

Method CopyRect

texteditor/select.go:406–420  ·  view source on GitHub ↗

CopyRect 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

404// CopyRect copies any selected text to the clipboard, and returns that text,
405// optionally resetting the current selection
406func (ed *Editor) CopyRect(reset bool) *text.Edit {
407 tbe := ed.Buffer.RegionRect(ed.SelectRegion.Start, ed.SelectRegion.End)
408 if tbe == nil {
409 return nil
410 }
411 cb := tbe.ToBytes()
412 ed.Clipboard().Write(mimedata.NewTextBytes(cb))
413 editorClipboardRect = tbe
414 if reset {
415 ed.SelectReset()
416 }
417 ed.savePosHistory(ed.CursorPos)
418 ed.NeedsRender()
419 return tbe
420}
421
422// PasteRect inserts text from the clipboard at current cursor position
423func (ed *Editor) PasteRect() {

Callers

nothing calls this directly

Calls 8

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

Tested by

no test coverage detected