Help us shape the future of Go! Take the 2026 Go Developer Survey

overlay

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package overlay is the shared fuzzy-picker component behind the command palette and the file finder: an input line over a filtered, scrollable list. The host supplies items and receives the chosen index.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CursorInto added in v0.16.0

func CursorInto(s string, cur int) string

CursorInto renders s with the block cursor at rune position cur.

func LineEdit added in v0.16.0

func LineEdit(s string, cur int, k tea.KeyMsg) (out string, ncur int, ok bool)

LineEdit applies one key to a single-line input with a rune cursor: arrows/Home/End/^A/^E move, Backspace/Delete edit, runes/space insert. ok=false means the key is not a text-editing key.

Types

type Item

type Item struct {
	Label  string
	Detail string
}

Item is one pickable row. Label is fuzzy-matched; Detail is dimmed, right-aligned (a keybinding, a directory).

type Model

type Model struct {
	Title string
	// contains filtered or unexported fields
}

func New

func New(title string, items []Item, width int) Model

func (*Model) ClickRow added in v0.13.1

func (m *Model) ClickRow(y int) bool

ClickRow selects the visible list row y (0 = the row right under the title) and reports whether it holds an item — false for a click on the box chrome or past the end of the list.

func (Model) Query

func (m Model) Query() string

Query returns the current input text.

func (Model) Selected

func (m Model) Selected() int

Selected returns the highlighted item's index into the original items, or -1 when the filter has no matches.

func (Model) Update

func (m Model) Update(k tea.KeyMsg) (Model, int, bool)

Update handles a key. done=true means the overlay is finished: chosen is the picked item's index into the original items, or -1 on cancel.

func (Model) View

func (m Model) View() string

View renders the overlay box; the app centers it over the editor.

func (*Model) Wheel added in v0.13.1

func (m *Model) Wheel(delta int)

Wheel scrolls the list by delta rows, dragging the selection along so it stays inside the visible window.

Jump to

Keyboard shortcuts

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