width

package
v0.2.16 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 5, 2023 License: LGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AdditionalZeroWidth = &unicode.RangeTable{
	R16: []unicode.Range16{
		{0x1160, 0x11FF, 1},
	},
}

AdditionalZeroWidth is a Unicode Range of expected zero-width glyphs outside of Cf, Mn, and Me.

View Source
var AmbiguousIsWide = false

AmbiguousIsWide sets if an unknown ambiguous character is assumed to be width == 2.

View Source
var DoubleWidth = &unicode.RangeTable{
	R32: []unicode.Range32{
		{Lo: 0x1F030, Hi: 0x1F061, Stride: 1},
		{Lo: 0x1F100, Hi: 0x1F1FF, Stride: 1},
		{Lo: 0x1F200, Hi: 0x1F2FF, Stride: 1},
		{Lo: 0x1F300, Hi: 0x1F5FF, Stride: 1},
		{Lo: 0x1F600, Hi: 0x1F64F, Stride: 1},
		{Lo: 0x1F680, Hi: 0x1F6FF, Stride: 1},
		{Lo: 0x1F900, Hi: 0x1F9FF, Stride: 1},
	},
}

DoubleWidth is a Unicode Range that can be safely assumed to be Wide, even if not EastAsian{Wide,Fullwidth}.

ZeroWidth is a Unicode Range that can be expected to be zero-width glyphs on a terminal.

Functions

func Rune

func Rune(r rune) int

Rune returns the expected display width of a rune. The logic largely matches what PuTTY does.

Control Characters other than NUL return a value of -1.

func String

func String(s string) int

String returns the sum display length expected of the string given.

If any rune in the string returns a width of -1, this function will return -1.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL