| 1 |
// Package wcwidth provides utilities for calculating character width. |
| 2 |
package wcwidth |
| 3 |
|
| 4 |
import ( |
| 5 |
"github.com/mattn/go-runewidth" |
| 6 |
) |
| 7 |
|
| 8 |
// RuneWidth returns fixed-width width of rune. |
| 9 |
// |
| 10 |
// Deprecated: this is now a wrapper around go-runewidth. Use go-runewidth |
| 11 |
// directly. |
| 12 |
func RuneWidth(r rune) int { |
| 13 |
return runewidth.RuneWidth(r) |
| 14 |
} |
| 15 |
|
| 16 |
// StringWidth returns fixed-width width of string. |
| 17 |
// |
| 18 |
// Deprecated: this is now a wrapper around go-runewidth. Use go-runewidth |
| 19 |
// directly. |
| 20 |
func StringWidth(s string) (n int) { |
| 21 |
return runewidth.StringWidth(s) |
| 22 |
} |