deleteSelection deletes any selected text, without adding to clipboard -- returns text deleted
()
| 1021 | // deleteSelection deletes any selected text, without adding to clipboard -- |
| 1022 | // returns text deleted |
| 1023 | func (tf *TextField) deleteSelection() string { |
| 1024 | tf.selectUpdate() |
| 1025 | if !tf.hasSelection() { |
| 1026 | return "" |
| 1027 | } |
| 1028 | cut := tf.selection() |
| 1029 | tf.edited = true |
| 1030 | tf.editText = append(tf.editText[:tf.selectStart], tf.editText[tf.selectEnd:]...) |
| 1031 | if tf.cursorPos > tf.selectStart { |
| 1032 | if tf.cursorPos < tf.selectEnd { |
| 1033 | tf.cursorPos = tf.selectStart |
| 1034 | } else { |
| 1035 | tf.cursorPos -= tf.selectEnd - tf.selectStart |
| 1036 | } |
| 1037 | } |
| 1038 | tf.selectReset() |
| 1039 | tf.NeedsRender() |
| 1040 | return cut |
| 1041 | } |
| 1042 | |
| 1043 | // copy copies any selected text to the clipboard. |
| 1044 | func (tf *TextField) copy() { //types:add |
no test coverage detected