Documentation
¶
Index ¶
- type ContactSelectedMsg
- type Model
- func (m *Model) ClearFilter()
- func (m *Model) ClickAt(localY int) (userID int64, ok bool)
- func (m Model) FilterActive() bool
- func (m Model) FilterQuery() string
- func (m Model) IsVisible() bool
- func (m *Model) LoadContacts() tea.Cmd
- func (m *Model) OpenFilter()
- func (m *Model) ScrollBy(n int)
- func (m *Model) SetContactsForTest(users []*telegram.User)
- func (m *Model) SetFocused(focused bool)
- func (m *Model) SetSize(width, height int)
- func (m *Model) SetVisible(visible bool)
- func (m Model) Update(msg tea.Msg) (Model, tea.Cmd)
- func (m Model) View() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ContactSelectedMsg ¶
type ContactSelectedMsg struct {
UserId int64
}
ContactSelectedMsg is emitted when a contact is selected.
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model is the contact list component.
func (*Model) ClearFilter ¶ added in v0.0.17
func (m *Model) ClearFilter()
ClearFilter drops the filter and closes the input, restoring the whole contact list. This is what `esc` does inside the input.
func (*Model) ClickAt ¶
ClickAt selects the contact shown at the given local row and returns its user ID. ok is false when the row has no contact — including row 0, which is the filter header rather than a contact.
func (Model) FilterActive ¶ added in v0.0.17
FilterActive reports whether the filter input is open and consuming keys. False once it closes, INCLUDING while a filter is still applied (`enter`) — that is a normal browsing state in which j/k and enter work as usual.
func (Model) FilterQuery ¶ added in v0.0.17
FilterQuery is the applied filter, "" when none.
func (*Model) LoadContacts ¶
LoadContacts fetches the contact list.
func (*Model) OpenFilter ¶ added in v0.0.17
func (m *Model) OpenFilter()
OpenFilter opens the filter input over the contact list.
The caller has consumed the key that asked for it: internal/app matches keys.search and returns, so this component never sees that press. The next key it does see is the first character of the query, and a "/" among them is a literal — a swallow here would make a query starting with one impossible to type.
func (*Model) SetContactsForTest ¶ added in v0.0.17
SetContactsForTest seeds the list without a Telegram client, so a caller in another package can render the column. The load path is otherwise the only way in, and it needs a live connection.
func (*Model) SetVisible ¶
SetVisible shows or hides the contacts panel.
Closing it drops any filter. The panel is opened to look somebody up, and a reader who narrowed it to one name, closed it, and came back to a list of one would be reading a state they had forgotten setting — the header says why, but "why is this list short" is a question the panel should not be asking on the way in.
func (Model) View ¶
View renders the contact list into the column the chat list otherwise occupies: a filter header and then the rows, on the same grid, with no frame of its own.
It used to render a bold "Contacts" heading over a box it sized itself, which is the pre-2.0 overlay idiom — a different palette and a different geometry from the column it was drawn into. The frame owns the surface; this returns lines and lets it.