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

Method cursorDelete

core/textfield.go:809–823  ·  view source on GitHub ↗

cursorDelete deletes character(s) immediately after the cursor

(steps int)

Source from the content-addressed store, hash-verified

807
808// cursorDelete deletes character(s) immediately after the cursor
809func (tf *TextField) cursorDelete(steps int) {
810 if tf.hasSelection() {
811 tf.deleteSelection()
812 return
813 }
814 if tf.cursorPos+steps > len(tf.editText) {
815 steps = len(tf.editText) - tf.cursorPos
816 }
817 if steps <= 0 {
818 return
819 }
820 tf.edited = true
821 tf.editText = append(tf.editText[:tf.cursorPos], tf.editText[tf.cursorPos+steps:]...)
822 tf.NeedsRender()
823}
824
825// cursorBackspaceWord deletes words(s) immediately before cursor
826func (tf *TextField) cursorBackspaceWord(steps int) {

Callers 3

cursorKillMethod · 0.95
completeTextMethod · 0.95
handleKeyEventsMethod · 0.95

Calls 3

hasSelectionMethod · 0.95
deleteSelectionMethod · 0.95
NeedsRenderMethod · 0.80

Tested by

no test coverage detected