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

Method PasteRect

texteditor/select.go:423–441  ·  view source on GitHub ↗

PasteRect inserts text from the clipboard at current cursor position

()

Source from the content-addressed store, hash-verified

421
422// PasteRect inserts text from the clipboard at current cursor position
423func (ed *Editor) PasteRect() {
424 if editorClipboardRect == nil {
425 return
426 }
427 ce := editorClipboardRect.Clone()
428 nl := ce.Reg.End.Ln - ce.Reg.Start.Ln
429 nch := ce.Reg.End.Ch - ce.Reg.Start.Ch
430 ce.Reg.Start.Ln = ed.CursorPos.Ln
431 ce.Reg.End.Ln = ed.CursorPos.Ln + nl
432 ce.Reg.Start.Ch = ed.CursorPos.Ch
433 ce.Reg.End.Ch = ed.CursorPos.Ch + nch
434 tbe := ed.Buffer.insertTextRect(ce, EditSignal)
435
436 pos := tbe.Reg.End
437 ed.SetCursorShow(pos)
438 ed.setCursorColumn(ed.CursorPos)
439 ed.savePosHistory(ed.CursorPos)
440 ed.NeedsRender()
441}
442
443// ReCaseSelection changes the case of the currently selected text.
444// Returns the new text; empty if nothing selected.

Callers

nothing calls this directly

Calls 6

SetCursorShowMethod · 0.95
setCursorColumnMethod · 0.95
savePosHistoryMethod · 0.95
NeedsRenderMethod · 0.80
CloneMethod · 0.65
insertTextRectMethod · 0.45

Tested by

no test coverage detected