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

Method selectUpdate

core/textfield.go:993–1005  ·  view source on GitHub ↗

selectUpdate updates the select region after any change to the text, to keep it in range

()

Source from the content-addressed store, hash-verified

991
992// selectUpdate updates the select region after any change to the text, to keep it in range
993func (tf *TextField) selectUpdate() {
994 if tf.selectStart < tf.selectEnd {
995 ed := len(tf.editText)
996 if tf.selectStart < 0 {
997 tf.selectStart = 0
998 }
999 if tf.selectEnd > ed {
1000 tf.selectEnd = ed
1001 }
1002 } else {
1003 tf.selectReset()
1004 }
1005}
1006
1007// cut cuts any selected text and adds it to the clipboard.
1008func (tf *TextField) cut() { //types:add

Callers 5

hasSelectionMethod · 0.95
selectRegionUpdateMethod · 0.95
deleteSelectionMethod · 0.95
copyMethod · 0.95
setCursorFromPixelMethod · 0.95

Calls 1

selectResetMethod · 0.95

Tested by

no test coverage detected