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

Function IsWordBreak

core/textfield.go:1967–1987  ·  view source on GitHub ↗

IsWordBreak defines what counts as a word break for the purposes of selecting words. r1 is the rune in question, r2 is the rune past r1 in the direction you are moving. Pass -1 for r2 if there is no rune past r1.

(r1, r2 rune)

Source from the content-addressed store, hash-verified

1965// r1 is the rune in question, r2 is the rune past r1 in the direction you are moving.
1966// Pass -1 for r2 if there is no rune past r1.
1967func IsWordBreak(r1, r2 rune) bool {
1968 if r2 == -1 {
1969 if unicode.IsSpace(r1) || unicode.IsSymbol(r1) || unicode.IsPunct(r1) {
1970 return true
1971 }
1972 return false
1973 }
1974 if unicode.IsSpace(r1) || unicode.IsSymbol(r1) {
1975 return true
1976 }
1977 if unicode.IsPunct(r1) && r1 != rune('\'') {
1978 return true
1979 }
1980 if unicode.IsPunct(r1) && r1 == rune('\'') {
1981 if unicode.IsSpace(r2) || unicode.IsSymbol(r2) || unicode.IsPunct(r2) {
1982 return true
1983 }
1984 return false
1985 }
1986 return false
1987}
1988
1989// concealDots creates an n-length []rune of bullet characters.
1990func concealDots(n int) []rune {

Callers 9

iSpellKeyInputMethod · 0.92
cursorForwardWordMethod · 0.92
cursorBackwardWordMethod · 0.92
wordBeforeMethod · 0.92
isWordEndMethod · 0.92
isWordMiddleMethod · 0.92
wordAtMethod · 0.92
cursorForwardWordMethod · 0.85
cursorBackwardWordMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected