paste inserts text from the clipboard at current cursor position; if cursor is within a current selection, that selection is replaced.
()
| 1057 | // paste inserts text from the clipboard at current cursor position; if |
| 1058 | // cursor is within a current selection, that selection is replaced. |
| 1059 | func (tf *TextField) paste() { //types:add |
| 1060 | data := tf.Clipboard().Read([]string{mimedata.TextPlain}) |
| 1061 | if data != nil { |
| 1062 | if tf.cursorPos >= tf.selectStart && tf.cursorPos < tf.selectEnd { |
| 1063 | tf.deleteSelection() |
| 1064 | } |
| 1065 | tf.insertAtCursor(data.Text(mimedata.TextPlain)) |
| 1066 | } |
| 1067 | } |
| 1068 | |
| 1069 | // insertAtCursor inserts the given text at current cursor position. |
| 1070 | func (tf *TextField) insertAtCursor(str string) { |
no test coverage detected