From b610d436f35918103292baa814cf74919ba78c3c Mon Sep 17 00:00:00 2001 From: Oliver Date: Tue, 27 Apr 2021 13:28:32 +0200 Subject: [PATCH] Minor improvements. --- ansi.go | 8 ++++---- demos/inputfield/autocompleteasync/main.go | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ansi.go b/ansi.go index 49b2e92..b63b478 100644 --- a/ansi.go +++ b/ansi.go @@ -128,19 +128,19 @@ func (a *ansi) Write(text []byte) (int, error) { for index, field := range fields { switch field { case "1", "01": - if strings.IndexRune(a.attributes, 'b') < 0 { + if !strings.ContainsRune(a.attributes, 'b') { a.attributes += "b" } case "2", "02": - if strings.IndexRune(a.attributes, 'd') < 0 { + if !strings.ContainsRune(a.attributes, 'd') { a.attributes += "d" } case "4", "04": - if strings.IndexRune(a.attributes, 'u') < 0 { + if !strings.ContainsRune(a.attributes, 'u') { a.attributes += "u" } case "5", "05": - if strings.IndexRune(a.attributes, 'l') < 0 { + if !strings.ContainsRune(a.attributes, 'l') { a.attributes += "l" } case "22": diff --git a/demos/inputfield/autocompleteasync/main.go b/demos/inputfield/autocompleteasync/main.go index 0cfe75c..b724329 100644 --- a/demos/inputfield/autocompleteasync/main.go +++ b/demos/inputfield/autocompleteasync/main.go @@ -12,7 +12,7 @@ import ( ) type company struct { - Name string `json:name` + Name string `json:"name"` } func main() {