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

filelist

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package filelist renders the changed-file list, either as a one-line summary of the selected file or as a full list, with an inline filter over the paths.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MatchRange

type MatchRange struct {
	Start int
	End   int
}

MatchRange is a search hit inside a file path, as byte offsets with End exclusive.

type Model

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

Model is the file list's state. Every mutator takes a pointer receiver, so a caller holding a value must copy the result back into its own state.

func New

func New() Model

New returns a collapsed, unfiltered list with no files.

func (Model) FilterQuery

func (m Model) FilterQuery() string

FilterQuery returns the current filter text.

func (Model) IsExpanded

func (m Model) IsExpanded() bool

IsExpanded reports whether the full list is drawn.

func (Model) IsFilterMode

func (m Model) IsFilterMode() bool

IsFilterMode reports whether the inline filter is open.

func (*Model) SetExpanded

func (m *Model) SetExpanded(expanded bool)

SetExpanded switches between the one-line summary and the full list.

func (*Model) SetFiles

func (m *Model) SetFiles(files []diff.FileChange)

SetFiles replaces the list contents. It leaves the selected index alone, so a caller shrinking the list must clamp the selection itself.

func (*Model) SetFilterMode

func (m *Model) SetFilterMode(enabled bool)

SetFilterMode opens or closes the inline path filter. Closing it also clears the query, so a reopened filter starts empty.

func (*Model) SetFilterQuery

func (m *Model) SetFilterQuery(query string)

SetFilterQuery replaces the filter text. It does not move the selection, so the diff pane keeps showing whatever file was selected before the filter narrowed the list.

func (*Model) SetSearchState

func (m *Model) SetSearchState(isSearching bool, getMatches func(fileIdx int) []MatchRange)

SetSearchState stores the hit lookup for path highlighting. The render path does not read it yet, so setting it has no visible effect.

func (*Model) SetSelected

func (m *Model) SetSelected(idx int)

SetSelected moves the cursor to an index into the unfiltered file slice.

func (Model) View

func (m Model) View(width, height int, focused bool) string

View renders the list at the given size, using only one row when collapsed regardless of height.

Jump to

Keyboard shortcuts

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