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 ¶
- type MatchRange
- type Model
- func (m Model) FilterQuery() string
- func (m Model) IsExpanded() bool
- func (m Model) IsFilterMode() bool
- func (m *Model) SetExpanded(expanded bool)
- func (m *Model) SetFiles(files []diff.FileChange)
- func (m *Model) SetFilterMode(enabled bool)
- func (m *Model) SetFilterQuery(query string)
- func (m *Model) SetSearchState(isSearching bool, getMatches func(fileIdx int) []MatchRange)
- func (m *Model) SetSelected(idx int)
- func (m Model) View(width, height int, focused bool) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MatchRange ¶
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 (Model) FilterQuery ¶
FilterQuery returns the current filter text.
func (Model) IsExpanded ¶
IsExpanded reports whether the full list is drawn.
func (Model) IsFilterMode ¶
IsFilterMode reports whether the inline filter is open.
func (*Model) SetExpanded ¶
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 ¶
SetFilterMode opens or closes the inline path filter. Closing it also clears the query, so a reopened filter starts empty.
func (*Model) SetFilterQuery ¶
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 ¶
SetSelected moves the cursor to an index into the unfiltered file slice.