thumbs

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2025 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CompiledDefaultPatterns = []*regexp.Regexp{}
View Source
var DefaultPatterns = []string{

	`\[[^\]]*\]\(([^)]+)\)`,

	`(?P<match>(https?://|git@|git://|ssh://|ftp://|file:///)[^\s]+)`,

	`diff --git a/([.\w\-@~\[\]]+?/[.\w\-@\[\]]+) b/([.\w\-@~\[\]]+?/[.\w\-@\[\]]+)`,

	`--- a/([^\s]+)`,

	`\+\+\+ b/([^\s]+)`,

	`sha256:([0-9a-f]{64})`,

	`(?P<match>([.\w\-@$~\[\]]+)?(/[.\w\-@$\[\]]+)+)`,

	`#[0-9a-fA-F]{6}`,

	`[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}`,

	`Qm[0-9a-zA-Z]{44}`,

	`[0-9a-f]{7,40}`,

	`\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}`,

	`[A-f0-9:]+:+[A-f0-9:]+[%\w\d]+`,

	`0x[0-9a-fA-F]+`,

	`[0-9]{4,}`,
}

Functions

func AssignHints

func AssignHints(
	alphabet []rune,
	matches []Match,
	origin geom.Vec2,
) (hints map[string]Match)

AssignHints assigns hints to `matches` by giving shorter hints to matches that are closer to `origin`.

func New

func New(
	ctx context.Context,
	initial image.Image,
	origin geom.Vec2,
	matches []Match,
	settings ...Setting,
) *taro.Program

func ValidateAlphabet

func ValidateAlphabet(alphabet []rune) error

Types

type Match

type Match []geom.Vec2

func Find

func Find(
	patterns []*regexp.Regexp,
	i image.Image,
) (matches []Match)

Find searches `i` for all matches of `patterns` and resolves them (after deconfliction) into `Match`es.

type Setting

type Setting func(context.Context, *Thumbs)

func WithAlphabet

func WithAlphabet(alphabet []rune) Setting

WithAlphabet sets the alphabet to use for generating hints

func WithParams

func WithParams(params *params.Parameters) Setting

WithParams provides parameters this Thumbs will use for rendering

func WithResult

func WithResult(result chan<- interface{}) Setting

type Thumbs

type Thumbs struct {
	util.Lifetime
	// contains filtered or unexported fields
}

Thumbs represents the thumbs picker interface

func (*Thumbs) Init

func (t *Thumbs) Init() taro.Cmd

func (*Thumbs) Update

func (t *Thumbs) Update(msg tea.Msg) (taro.Model, tea.Cmd)

func (*Thumbs) View

func (t *Thumbs) View(state *tty.State)

Jump to

Keyboard shortcuts

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