Add editor packages
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
package glyph
|
||||
|
||||
import "github.com/mattn/go-runewidth"
|
||||
|
||||
// Width returns the terminal column width of a rune.
|
||||
// Tabs use a fixed width of 8 columns.
|
||||
// TODO: handle Unicode marks.
|
||||
func Width(r rune) int {
|
||||
switch r {
|
||||
case '\t':
|
||||
return 8
|
||||
default:
|
||||
return runewidth.RuneWidth(r)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user