search

package
v0.0.15 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Model

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

Model is the search overlay component.

func New

func New(s *store.Store, tg *telegram.Client, r theme.Roles) Model

New creates a new search model.

func (Model) IsVisible

func (m Model) IsVisible() bool

IsVisible returns whether the search is visible.

func (Model) Query

func (m Model) Query() string

Query returns the current search text, whether typed or pre-filled.

func (*Model) SetQuery

func (m *Model) SetQuery(q string)

SetQuery pre-fills the search input, leaving the cursor at the end so the user can keep typing. It does not run the search — the overlay searches on Enter, and a command that both opened the overlay and fired a network request would be doing two things the caller only asked once for.

Call it AFTER SetVisible(true): making the overlay visible deliberately resets the query, so the reverse order silently discards the prefill.

func (*Model) SetSize

func (m *Model) SetSize(width, height int)

SetSize sets the component dimensions. width/height are the FULL window size — the overlay computes its own centered, capped box from them (see computeGeometry) rather than stretching to fill the window.

func (*Model) SetVisible

func (m *Model) SetVisible(visible bool)

SetVisible shows or hides the search overlay.

func (Model) Update

func (m Model) Update(msg tea.Msg) (Model, tea.Cmd)

Update handles messages.

func (Model) View

func (m Model) View() string

View renders the search overlay.

type SearchResultMsg

type SearchResultMsg struct {
	ChatId    int64
	MessageId int64
}

SearchResultMsg is emitted when a search result is selected.

type Tab

type Tab int

Tab represents a search tab.

const (
	TabChats Tab = iota
	TabMessages
	TabGlobal
)

Jump to

Keyboard shortcuts

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