1
0
mirror of https://github.com/makew0rld/amfora.git synced 2024-12-04 14:46:29 -05:00

🚧 Update cview so WordWrap uses string again

Compile still failing
This commit is contained in:
makeworld 2020-10-12 12:06:57 -04:00
parent 5498987db0
commit a9a4de1484
4 changed files with 6 additions and 9 deletions

View File

@ -5,7 +5,6 @@
## Regressions ## Regressions
- WordWrap uses `[]byte` now, filed [issue 40](https://gitlab.com/tslocum/cview/-/issues/40)
## Upstream Bugs ## Upstream Bugs

2
go.mod
View File

@ -20,7 +20,7 @@ require (
github.com/spf13/pflag v1.0.5 // indirect github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.7.0 github.com/spf13/viper v1.7.0
github.com/stretchr/testify v1.6.1 github.com/stretchr/testify v1.6.1
gitlab.com/tslocum/cview v1.5.1-0.20201011190730-b47c35329cc8 gitlab.com/tslocum/cview v1.5.1-0.20201012001533-298510a6852b
golang.org/x/text v0.3.3 golang.org/x/text v0.3.3
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
gopkg.in/ini.v1 v1.57.0 // indirect gopkg.in/ini.v1 v1.57.0 // indirect

4
go.sum
View File

@ -213,8 +213,8 @@ github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
gitlab.com/tslocum/cbind v0.1.2 h1:ptDjO7WeOl1HglprsK18L8I9JeRkmtuBoBBaYw/6/Ow= gitlab.com/tslocum/cbind v0.1.2 h1:ptDjO7WeOl1HglprsK18L8I9JeRkmtuBoBBaYw/6/Ow=
gitlab.com/tslocum/cbind v0.1.2/go.mod h1:HfB7qAhHSZbn1rFK8M9SvSN5NG6ScAg/3h3iE6xdeeI= gitlab.com/tslocum/cbind v0.1.2/go.mod h1:HfB7qAhHSZbn1rFK8M9SvSN5NG6ScAg/3h3iE6xdeeI=
gitlab.com/tslocum/cview v1.5.1-0.20201011190730-b47c35329cc8 h1:nPNhhivzphjY1p68Wc6Sbs7PtYKbHtWToeDeu8Od4ks= gitlab.com/tslocum/cview v1.5.1-0.20201012001533-298510a6852b h1:wVXKnAE2gt165dbOupmxBIcjLW7ZTRGAtUUAhyNAEHs=
gitlab.com/tslocum/cview v1.5.1-0.20201011190730-b47c35329cc8/go.mod h1:i9NyxtwBtkiVFrwmsh3Bv3dunvipjZrKX0TTdPHbzcw= gitlab.com/tslocum/cview v1.5.1-0.20201012001533-298510a6852b/go.mod h1:i9NyxtwBtkiVFrwmsh3Bv3dunvipjZrKX0TTdPHbzcw=
go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=

View File

@ -68,16 +68,14 @@ func wrapLine(line string, width int, prefix, suffix string, includeFirst bool)
} }
}() }()
wrapped := cview.WordWrap([]byte(line), width) wrapped := cview.WordWrap(line, width)
for i := range wrapped { for i := range wrapped {
if !includeFirst && i == 0 { if !includeFirst && i == 0 {
continue continue
} }
wrapped[i] = append(append([]byte(prefix), wrapped[i]...), []byte(suffix)...) wrapped[i] = prefix + wrapped[i] + suffix
}
for i := range wrapped {
ret = append(ret, string(wrapped[i]))
} }
ret = wrapped
}() }()
return ret return ret
} }