diff options
Diffstat (limited to 'helpfuncs.go')
| -rw-r--r-- | helpfuncs.go | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/helpfuncs.go b/helpfuncs.go index df49ae5..30d9967 100644 --- a/helpfuncs.go +++ b/helpfuncs.go @@ -8,8 +8,20 @@ import ( "os" "path" "strings" + "unicode" + + "math/rand/v2" ) +func isASCII(s string) bool { + for i := 0; i < len(s); i++ { + if s[i] > unicode.MaxASCII { + return false + } + } + return true +} + func colorText() { text := textView.GetText(false) quoteReplacer := strings.NewReplacer( @@ -63,7 +75,7 @@ func colorText() { } func updateStatusLine() { - position.SetText(makeStatusLine()) + statusLineWidget.SetText(makeStatusLine()) helpView.SetText(fmt.Sprintf(helpText, makeStatusLine())) } @@ -229,3 +241,13 @@ func makeStatusLine() string { isRecording, persona, botPersona, injectRole) return statusLine + imageInfo + shellModeInfo } + +var letters = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") + +func randString(n int) string { + b := make([]rune, n) + for i := range b { + b[i] = letters[rand.IntN(len(letters))] + } + return string(b) +} |
