fzfalgo

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: 7 Imported by: 0

Documentation

Overview

Package fzfalgo is a pure-Go extraction of fzf's fuzzy matcher, kept so it builds on every GOOS/GOARCH including js/wasm. Only FuzzyMatchV2 and its FuzzyMatchV1 fallback are kept; the exact/prefix/suffix/equal matchers, debug output and test hooks were dropped.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(scheme string) bool

Init selects the bonus scheme ("default", "path" or "history") and fills the ASCII class and bonus tables. Until it is called every bonus is zero and ASCII case folding is skipped in the score matrix, exactly as upstream behaves before its options are parsed. Not safe to call concurrently with matching.

Types

type Result

type Result struct {
	// TODO int32 should suffice
	Start int
	End   int
	Score int
}

Result contains the results of running a match function.

func FuzzyMatchV1

func FuzzyMatchV1(caseSensitive, normalize, forward bool, text *fzfutil.Chars, pattern []rune, withPos bool, slab *fzfutil.Slab) (Result, *[]int)

FuzzyMatchV1 performs fuzzy-match

func FuzzyMatchV2

func FuzzyMatchV2(caseSensitive, normalize, forward bool, input *fzfutil.Chars, pattern []rune, withPos bool, slab *fzfutil.Slab) (Result, *[]int)

Jump to

Keyboard shortcuts

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