fzfutil

package
v1.142.0 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package fzfutil holds the text container used by fzfalgo. Compared with upstream it keeps the byte and rune views in two fields instead of one unsafe-reinterpreted slice, and drops everything the matcher does not use.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MayFoldToASCII

func MayFoldToASCII(r rune) bool

MayFoldToASCII reports whether case folding or normalization could turn r into an ASCII character.

Types

type Chars

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

Chars is a line of text, kept as bytes when it is pure ASCII and as runes otherwise. The zero value is an empty ASCII text.

func ToChars

func ToChars(bytes []byte) Chars

ToChars converts a byte array into a Chars. Pure ASCII input is kept as is; anything else is decoded into runes, one utf8.RuneError per invalid byte.

func (*Chars) Bytes

func (chars *Chars) Bytes() []byte

Bytes returns the underlying byte slice, or nil if the text is kept as runes. Read only.

func (*Chars) CopyRunes

func (chars *Chars) CopyRunes(dest []rune, from int)

CopyRunes copies len(dest) runes starting at from into dest.

func (*Chars) Get

func (chars *Chars) Get(i int) rune

Get returns the rune at index i.

func (*Chars) IsBytes

func (chars *Chars) IsBytes() bool

IsBytes reports whether the text is pure ASCII and kept as bytes.

func (*Chars) Length

func (chars *Chars) Length() int

Length returns the number of runes in the text.

func (*Chars) MayFoldToASCII

func (chars *Chars) MayFoldToASCII() bool

MayFoldToASCII reports whether the text holds a rune that case folding or normalization could turn into an ASCII character. When false, an ASCII pattern character can only match the identical ASCII rune, which is what lets the prefilter scan the rune array directly.

func (*Chars) Runes

func (chars *Chars) Runes() []rune

Runes returns the underlying rune slice, or nil if the text is kept as bytes. Read only.

type Slab

type Slab struct {
	I16 []int16
	I32 []int32
}

Slab is a pre-allocated scratch space the matcher reuses across calls to avoid allocating its score matrices.

func MakeSlab

func MakeSlab(size16, size32 int) *Slab

MakeSlab allocates a Slab with the given capacities.

Jump to

Keyboard shortcuts

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