Copy copies any selected text to the clipboard, and returns that text, optionally resetting the current selection
(reset bool)
| 330 | // Copy copies any selected text to the clipboard, and returns that text, |
| 331 | // optionally resetting the current selection |
| 332 | func (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 |
| 349 | func (ed *Editor) Paste() { |
no test coverage detected