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

Method editDone

core/textfield.go:519–531  ·  view source on GitHub ↗

editDone completes editing and copies the active edited text to the [TextField.text]. It is called when the return key is pressed or the text field goes out of focus.

()

Source from the content-addressed store, hash-verified

517// editDone completes editing and copies the active edited text to the [TextField.text].
518// It is called when the return key is pressed or the text field goes out of focus.
519func (tf *TextField) editDone() {
520 if tf.edited {
521 tf.edited = false
522 tf.text = string(tf.editText)
523 tf.SendChange()
524 // widget can be killed after SendChange
525 if tf.This == nil {
526 return
527 }
528 }
529 tf.clearSelected()
530 tf.clearCursor()
531}
532
533// revert aborts editing and reverts to the last saved text.
534func (tf *TextField) revert() {

Callers 5

InitMethod · 0.95
TextMethod · 0.95
completeTextMethod · 0.95
handleKeyEventsMethod · 0.95
SelectedFileMethod · 0.45

Calls 3

clearSelectedMethod · 0.95
clearCursorMethod · 0.95
SendChangeMethod · 0.80

Tested by

no test coverage detected