Documentation
¶
Overview ¶
Package charnames is the Unicode character name table the launcher searches: every character the Unicode Character Database names, with its aliases, generated by internal/tools/unicodegen and embedded compressed. In memory it stays in its encoded form, each name a few varint word ids into one word list, and a search walks it without allocating.
Index ¶
Constants ¶
const ( HexTail = 0 FirstWord = 1 MaxNameCodes = 15 HasAliases = 1 << 6 HasGap = 1 << 7 )
The encoding's codes: a name is a sequence of word codes, each a varint word id from FirstWord on (a word is one or more words of the name, so common phrases cost one code), or HexTail for "-" and the character's own code point in hex, which ends algorithmic names such as CJK COMPATIBILITY IDEOGRAPH-F900. An entry's head byte holds its name's code count (at most MaxNameCodes), its Kind shifted by 4, and the HasAliases and HasGap flags.
const Magic = "lys-charnames/2\n"
Magic starts the encoded table.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Searcher ¶
type Searcher struct {
// contains filtered or unexported fields
}
Searcher finds characters by name. It reuses its memory across searches, so a search allocates nothing once warm; it belongs to one goroutine.
func (*Searcher) Search ¶
Search is the limit best characters for query, best first: each of its words starts a word of the name or of an alias, and the fuzzy score of the name (or, found only by an alias, of the name and aliases, for less) ranks them. An empty query lists the first characters. "U+2192" and a character typed as itself find that character. The result is valid until the next Search.
type Table ¶
type Table struct {
// contains filtered or unexported fields
}
Table is the decoded name table.
func (*Table) AppendName ¶
AppendName appends c's name in title case ("Rightwards Arrow").