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

Method cursorBackspace

core/textfield.go:791–806  ·  view source on GitHub ↗

cursorBackspace deletes character(s) immediately before cursor

(steps int)

Source from the content-addressed store, hash-verified

789
790// cursorBackspace deletes character(s) immediately before cursor
791func (tf *TextField) cursorBackspace(steps int) {
792 if tf.hasSelection() {
793 tf.deleteSelection()
794 return
795 }
796 if tf.cursorPos < steps {
797 steps = tf.cursorPos
798 }
799 if steps <= 0 {
800 return
801 }
802 tf.edited = true
803 tf.editText = append(tf.editText[:tf.cursorPos-steps], tf.editText[tf.cursorPos:]...)
804 tf.cursorBackward(steps)
805 tf.NeedsRender()
806}
807
808// cursorDelete deletes character(s) immediately after the cursor
809func (tf *TextField) cursorDelete(steps int) {

Callers 1

handleKeyEventsMethod · 0.95

Calls 4

hasSelectionMethod · 0.95
deleteSelectionMethod · 0.95
cursorBackwardMethod · 0.95
NeedsRenderMethod · 0.80

Tested by

no test coverage detected