composer

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AttachRequestedMsg

type AttachRequestedMsg struct{}

AttachRequestedMsg is emitted when the user asks to attach a file (Ctrl+T).

type MessageSubmittedMsg

type MessageSubmittedMsg struct {
	ChatId        int64
	Text          string
	ReplyToId     int64
	EditMessageId int64
	Attachment    string // local file path, empty if none
}

MessageSubmittedMsg is emitted when the user submits a message.

type Mode

type Mode int

Mode represents the composer's current mode.

const (
	ModeNormal Mode = iota
	ModeReply
	ModeEdit
)

type Model

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

Model is the message composer component.

func New

func New(th *theme.Theme) Model

New creates a new composer model.

func (*Model) EnterEditMode

func (m *Model) EnterEditMode(messageID int64, currentText string)

EnterEditMode starts editing a message.

func (*Model) EnterReplyMode

func (m *Model) EnterReplyMode(messageID int64, previewText string)

EnterReplyMode starts replying to a message.

func (*Model) Reset

func (m *Model) Reset()

Reset clears the composer state.

func (*Model) SetAttachment

func (m *Model) SetAttachment(path string)

SetAttachment sets the pending attachment path shown above the composer.

func (*Model) SetChatId

func (m *Model) SetChatId(chatID int64)

SetChatId sets the active chat for the composer.

func (*Model) SetFocused

func (m *Model) SetFocused(focused bool)

SetFocused sets focus state.

func (*Model) SetSize

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

SetSize sets the component dimensions.

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 composer.

Jump to

Keyboard shortcuts

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