bcicen / ctop

Top-like interface for container metrics
https://ctop.sh
MIT License
15.61k stars 528 forks source link

Use go-runewidth to increment x in TextView #264

Closed garsue closed 3 years ago

garsue commented 3 years ago

This PR fixes rendering wide-width characters in TextView. When running the following container, ctop shows incomplete logs.

docker container run debian:buster yes こんにちは

image

TextView always renders characters as single width. So wide-width characters hide the next character. go-runewidth fixes this problem.

image

stokito commented 3 years ago

shouldn't the runewidth be added into go.mod file?

garsue commented 3 years ago

shouldn't the runewidth be added into go.mod file?

go.mod looks like already includes. https://github.com/bcicen/ctop/blob/0094cba5eaebcf478282655b1de7a8605cdbf3a9/go.mod#L9

But after building this PR, some diffs appear in go.sum. Should I also commit them?

stokito commented 3 years ago

I don’t know, I guess not necessary.

garsue commented 3 years ago

I pushed it. It is not necessary but it is annoying in development. Maybe we should do go mod tidy to clean up dependencies.

bcicen commented 3 years ago

merged; thanks @garsue !!