wcswidth

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2024 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var UnicodeDatabaseVersion [3]int = [3]int{16, 0, 0}

Functions

func IsEmojiPresentationBase

func IsEmojiPresentationBase(code rune) bool

func IsFlagCodepoint

func IsFlagCodepoint(ch rune) bool

func IsFlagPair

func IsFlagPair(a rune, b rune) bool

func Runewidth

func Runewidth(code rune) int

func Stringwidth

func Stringwidth(text string) int

func StripEscapeCodes

func StripEscapeCodes(text string) string

func TruncateToVisualLength

func TruncateToVisualLength(text string, length int) string

func TruncateToVisualLengthWithWidth

func TruncateToVisualLengthWithWidth(text string, length int) (truncated string, width_of_truncated int)

Types

type CellIterator

type CellIterator struct {
	// contains filtered or unexported fields
}

func NewCellIterator

func NewCellIterator(text string) *CellIterator

func (*CellIterator) Backward

func (self *CellIterator) Backward() (has_more bool)

func (*CellIterator) Current

func (self *CellIterator) Current() string

func (*CellIterator) Forward

func (self *CellIterator) Forward() (has_more bool)

func (*CellIterator) GotoEnd

func (self *CellIterator) GotoEnd() *CellIterator

func (*CellIterator) GotoStart

func (self *CellIterator) GotoStart() *CellIterator

type EscapeCodeParser

type EscapeCodeParser struct {
	ReplaceInvalidUtf8Bytes bool

	// Callbacks
	HandleRune                func(rune) error
	HandleEndOfBracketedPaste func() error
	HandleCSI                 func([]byte) error
	HandleOSC                 func([]byte) error
	HandleDCS                 func([]byte) error
	HandlePM                  func([]byte) error
	HandleSOS                 func([]byte) error
	HandleAPC                 func([]byte) error
	// contains filtered or unexported fields
}

func (*EscapeCodeParser) InBracketedPaste

func (self *EscapeCodeParser) InBracketedPaste() bool

func (*EscapeCodeParser) Parse

func (self *EscapeCodeParser) Parse(data []byte) error

func (*EscapeCodeParser) ParseByte

func (self *EscapeCodeParser) ParseByte(b byte) error

func (*EscapeCodeParser) ParseString

func (self *EscapeCodeParser) ParseString(s string) error

func (*EscapeCodeParser) Reset

func (self *EscapeCodeParser) Reset()

type WCWidthIterator

type WCWidthIterator struct {
	// contains filtered or unexported fields
}

func CreateWCWidthIterator

func CreateWCWidthIterator() *WCWidthIterator

func (*WCWidthIterator) CurrentWidth

func (self *WCWidthIterator) CurrentWidth() int

func (*WCWidthIterator) Parse

func (self *WCWidthIterator) Parse(b []byte) (ans int)

func (*WCWidthIterator) ParseByte

func (self *WCWidthIterator) ParseByte(b byte) (ans int)

func (*WCWidthIterator) Reset

func (self *WCWidthIterator) Reset()

Jump to

Keyboard shortcuts

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