moji

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// SurrogatePairOk is true when the surrogated pair unicode is supported
	// If it is false, <NNNN> is displayed instead.
	SurrogatePairOk = isWindowsTerminal || isWezTerm || isContour

	// ZeroWidthJoinSequenceOk is true when ZWJ(U+200D) is supported.
	// If it is false, <NNNN> is displayed instead.
	ZeroWidthJoinSequenceOk = isWindowsTerminal || isWezTerm || isContour

	// VariationSequenceOk is true when Variation Sequences are supported.
	// If it is false, <NNNN> is displayed instead.
	VariationSequenceOk = isWindowsTerminal || isWezTerm || isContour

	// ModifierSequenceOk is false, SkinTone sequence are treated as two
	// character
	ModifierSequenceOk = isWindowsTerminal || isWezTerm

	// AmbiguousIsWide is true, EastAsianAmbiguous are treated as two width
	AmbiguousIsWide = !isWindowsTerminal
)

Functions

func AreEmojiModifier

func AreEmojiModifier(s string) bool

func AreVariationSelectorLike

func AreVariationSelectorLike(s string) bool

func AreZeroWidthJoin

func AreZeroWidthJoin(s string) bool

func IsSpaceMoji

func IsSpaceMoji(m Moji) bool

func MojiToRune

func MojiToRune(m Moji) (rune, bool)

func ResetCharWidth

func ResetCharWidth()

ResetCharWidth resets the cache for the width of characters.

func SetCharWidth

func SetCharWidth(c rune, width int)

SetCharWidth sets the width of the character into the cache.

Types

type Moji

type Moji interface {
	Width() WidthT
	WriteTo(io.Writer) (int64, error)
	PrintTo(io.Writer)
}

Moji is the interface for minimum unit to edit in readline

When we make a new implement type of Moji, we have to append the code in the function: StringToMoji() and KeyFuncInsertSelf().

func StringToMoji

func StringToMoji(s string) []Moji

type Tab added in v0.13.0

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

func (*Tab) PrintTo added in v0.13.0

func (t *Tab) PrintTo(w io.Writer)

func (*Tab) SetPosition added in v0.13.0

func (t *Tab) SetPosition(pos int16)

func (*Tab) Width added in v0.13.0

func (t *Tab) Width() WidthT

func (*Tab) WriteTo added in v0.13.0

func (t *Tab) WriteTo(w io.Writer) (int64, error)

type WidthT

type WidthT int

WidthT means the width type

func MojiWidthAndCountInString added in v0.11.6

func MojiWidthAndCountInString(s string) (width WidthT, count int)

Jump to

Keyboard shortcuts

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