Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Go Dependency: Bump zgo.at/termtext from 1.3.0 to 1.4.0 #213

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ require (
github.com/mattn/go-runewidth v0.0.15 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
golang.org/x/sys v0.19.0 // indirect
zgo.at/termtext v1.3.0 // indirect
zgo.at/termtext v1.4.0 // indirect
)
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
zgo.at/acidtab v1.0.0 h1:KtXvxtY0uXKNQW1dz113e++5XodEs5HEqIO9AJDT7Nk=
zgo.at/acidtab v1.0.0/go.mod h1:dOHM1/D5cRCsskzFmyniTDVZjuwnqFdAcvRiT3RTvY0=
zgo.at/termtext v0.0.0-20211017203350-a2beb4680d76/go.mod h1:P0jvULwo8z82ad7+WR6vg5vTy86dqvbOmR3bT3NlYvc=
zgo.at/termtext v1.3.0 h1:aJRg7PJOJHJCsWnzmYk8iLWP/bd9rfw9zOmyMNxzyXk=
zgo.at/termtext v1.3.0/go.mod h1:CBx+HpG2ijB3W0Bd4CK8UtzcsXw+EmvvlhQUyQpZO+E=
zgo.at/termtext v1.4.0 h1:r7fzyT5jsdRw9Z0uCQh+A+TWhWk+pC5HDJd1o8EH8NI=
zgo.at/termtext v1.4.0/go.mod h1:CBx+HpG2ijB3W0Bd4CK8UtzcsXw+EmvvlhQUyQpZO+E=
2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ golang.org/x/sys/unix
# zgo.at/acidtab v1.0.0
## explicit; go 1.16
zgo.at/acidtab
# zgo.at/termtext v1.3.0
# zgo.at/termtext v1.4.0
## explicit; go 1.16
zgo.at/termtext
20 changes: 20 additions & 0 deletions vendor/zgo.at/termtext/termtext.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,21 @@ import (
// Number of spaces to count a tab as.
var TabWidth = 8

// Widths sets the width for the given runes.
//
// This can be useful in some cases where the written text is different. For
// example when encoding JSON some characters get written as a \-escape. To
// account for this, you can override the width for those:
//
// termtext.Escapes = map[rune]int{
// '\b': 2,
// '\f': 2,
// '\n': 2,
// '\r': 2,
// '\t': 2,
// }
var Widths map[rune]int

// Width gets the display width of a string.
//
// The "display width" is the number of columns a string will occupy in a
Expand All @@ -32,6 +47,11 @@ func Width(s string) int {
continue
}

if ll, ok := Widths[runes[0]]; ok {
l += ll
continue
}

/// One codepoint: check for tab and escapes.
switch r := runes[0]; {
case r == '\t':
Expand Down