widgets

package
v0.0.0-...-ab76223 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2022 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const DraftMarker = "~"

Variables

This section is empty.

Functions

func AttachFromClipboard

func AttachFromClipboard(parent *ChatWindow) error

AttachFromClipboard attaches a file directly from clipboard. Text is just pasted into the message.

func CompletePath

func CompletePath(path string) string

CompletePath autocompletes a path stub

func FZFFile

func FZFFile() (string, error)

FZFFile opens up FZF and fuzzy-searches for a file

func FZFList

func FZFList(items []string) (string, error)

FZFList opens up FZF and fuzzy-searches from a list of strings

func FancyCompose

func FancyCompose() (string, error)

FancyCompose opens up EDITOR and composes a big fancy message.

func GetSharedPrefix

func GetSharedPrefix(s ...string) string

GetSharedPrefix finds the prefix shared by any number of strings Is there a more efficient way to do this?

Types

type ChatWindow

type ChatWindow struct {
	// todo: maybe use Flex instead of Grid?
	*tview.Grid
	// contains filtered or unexported fields
}

ChatWindow is the main panel for the UI.

func NewChatWindow

func NewChatWindow(siggo *model.Siggo, app *tview.Application) *ChatWindow

func (*ChatWindow) Compose

func (c *ChatWindow) Compose()

Compose opens an EDITOR to compose a command. If any text is saved in the buffer, we send it as a message to the current conversation.

func (*ChatWindow) ContactDown

func (c *ChatWindow) ContactDown()

func (*ChatWindow) ContactUp

func (c *ChatWindow) ContactUp()

TODO: remove code duplication with ContactDown()

func (*ChatWindow) FancyAttach

func (c *ChatWindow) FancyAttach()

FancyAttach opens FZF and selects a file to attach

func (*ChatWindow) FocusMe

func (c *ChatWindow) FocusMe()

FocusMe gives focus to the chat window

func (*ChatWindow) FuzzyGoTo

func (c *ChatWindow) FuzzyGoTo()

FuzzyGoTo goes to a contact or group with fuzzy matching

func (*ChatWindow) HideCommandInput

func (c *ChatWindow) HideCommandInput()

HideCommandInput hides any current CommandInput panel

func (*ChatWindow) HideConversation

func (c *ChatWindow) HideConversation(replacement tview.Primitive)

HideConversation temporarily replaces the conversation panel with another widget

func (*ChatWindow) HideStatusBar

func (c *ChatWindow) HideStatusBar()

HideStatusBar stops showing the status bar

func (*ChatWindow) InsertMode

func (c *ChatWindow) InsertMode()

InsertMode enters insert mode

func (*ChatWindow) LinkMode

func (c *ChatWindow) LinkMode()

LinkMode enters link mode

func (*ChatWindow) NextUnreadMessage

func (c *ChatWindow) NextUnreadMessage() error

NextUnreadMessage searches for the next conversation with unread messages and makes that the active conversation.

func (*ChatWindow) NormalMode

func (c *ChatWindow) NormalMode()

NormalMode enters normal mode

func (*ChatWindow) OpenMode

func (c *ChatWindow) OpenMode()

OpenMode enters open mode which lets us select an attachment to open

func (*ChatWindow) Paste

func (c *ChatWindow) Paste() error

func (*ChatWindow) Quit

func (c *ChatWindow) Quit()

Quit shuts down gracefully

func (*ChatWindow) SetCurrentContact

func (c *ChatWindow) SetCurrentContact(contact *model.Contact) error

SetCurrentContact sets the active contact

func (*ChatWindow) SetCurrentContactByString

func (c *ChatWindow) SetCurrentContactByString(contactName string) error

SetCurrentContactByString sets the active contact to the first contact whose string representation matches

func (*ChatWindow) SetErrorStatus

func (c *ChatWindow) SetErrorStatus(err error)

SetErrorStatus shows an error status in the status bar

func (*ChatWindow) SetStatus

func (c *ChatWindow) SetStatus(statusMsg string)

SetStatus shows a status message on the status bar

func (*ChatWindow) ShowAttachInput

func (c *ChatWindow) ShowAttachInput()

ShowAttachInput opens a commandPanel to choose a file to attach

func (*ChatWindow) ShowConversation

func (c *ChatWindow) ShowConversation()

ShowConversation ensures that the conversation panel is showing. This should be called when any widget is done hiding the conversation panel

func (*ChatWindow) ShowFilterInput

func (c *ChatWindow) ShowFilterInput()

ShowFilterInput opens a commandPanel to filter the conversation

func (*ChatWindow) ShowStatusBar

func (c *ChatWindow) ShowStatusBar()

ShowStatusBar shows the bottom status bar

func (*ChatWindow) ShowTempSentMsg

func (c *ChatWindow) ShowTempSentMsg(msg string)

ShowTempSentMsg shows a temporary message when a message is sent but before delivery. Only displayed for the second or two after a message is sent.

func (c *ChatWindow) YankLastLink()

YankLastLink copies the last link in a converstaion to the clipboard

func (*ChatWindow) YankLastMsg

func (c *ChatWindow) YankLastMsg()

YankLastMsg copies the last message of a conversation to the clipboard.

func (*ChatWindow) YankMode

func (c *ChatWindow) YankMode()

YankMode enters yank mode

type CommandInput

type CommandInput struct {
	*tview.InputField
	// contains filtered or unexported fields
}

CommandInput is an input field that appears at the bottom of the window and allows for various commands

func NewAttachInput

func NewAttachInput(parent *ChatWindow) *CommandInput

NewAttachInput is a command input that selects an attachment and attaches it to the current conversation to be sent in the next message.

func NewFilterInput

func NewFilterInput(parent *ChatWindow) *CommandInput

NewFilterInput is a command input that lets you filter the current conversation

type ContactListPanel

type ContactListPanel struct {
	*tview.TextView
	// contains filtered or unexported fields
}

func NewContactListPanel

func NewContactListPanel(parent *ChatWindow, siggo *model.Siggo) *ContactListPanel

NewContactListPanel creates a new contact list widget

func (*ContactListPanel) GotoContact

func (cl *ContactListPanel) GotoContact(contact *model.Contact)

GotoContact goes to a particular contact. TODO: constant time way to do this?

func (*ContactListPanel) GotoIndex

func (cl *ContactListPanel) GotoIndex(index int) *model.Contact

GotoIndex goes to a particular contact index and return the Contact. Negative indexing is allowed.

func (*ContactListPanel) Next

func (cl *ContactListPanel) Next() *model.Contact

func (*ContactListPanel) Previous

func (cl *ContactListPanel) Previous() *model.Contact

func (*ContactListPanel) Render

func (cl *ContactListPanel) Render()

Render the contact list

type ConversationPanel

type ConversationPanel struct {
	*tview.TextView
	// contains filtered or unexported fields
}

func NewConversationPanel

func NewConversationPanel(siggo *model.Siggo) *ConversationPanel

func (*ConversationPanel) Clear

func (p *ConversationPanel) Clear()

func (*ConversationPanel) Filter

func (p *ConversationPanel) Filter(s string)

func (*ConversationPanel) Update

func (p *ConversationPanel) Update(conv *model.Conversation)

type LinksInput

type LinksInput struct {
	*tview.List
	// contains filtered or unexported fields
}

LinksInput is a widget that allows us to select from links in the conversation

func NewLinksInput

func NewLinksInput(parent *ChatWindow) *LinksInput

func (*LinksInput) Close

func (li *LinksInput) Close()

func (*LinksInput) Next

func (li *LinksInput) Next()

func (*LinksInput) OpenLast

func (li *LinksInput) OpenLast()

OpenLast opens the most recent link

func (li *LinksInput) OpenLink(link string)

OpenLink opens any URL

func (*LinksInput) OpenSelected

func (li *LinksInput) OpenSelected()

OpenSelected opens whichever link is selected

func (*LinksInput) Previous

func (li *LinksInput) Previous()

func (*LinksInput) YankSelected

func (li *LinksInput) YankSelected()

YankSelected copies copies the currently selected link to the clipboard

type Mode

type Mode int
const (
	NormalMode Mode = iota
	InsertMode
	YankMode
	OpenMode
	LinkMode
)

type OpenInput

type OpenInput struct {
	*tview.List
	// contains filtered or unexported fields
}

OpenInput is a widget that allows us to select an attachment to open.

func NewOpenInput

func NewOpenInput(parent *ChatWindow) *OpenInput

func (*OpenInput) Close

func (oi *OpenInput) Close()

func (*OpenInput) Next

func (oi *OpenInput) Next()

func (*OpenInput) OpenAttachment

func (oi *OpenInput) OpenAttachment(attachment *model.Attachment)

OpenAttachment opens a `*signal.Attachment`

func (*OpenInput) OpenLast

func (oi *OpenInput) OpenLast()

OpenLastAttachment opens the last attachment that it finds in the conversation

func (*OpenInput) OpenPath

func (oi *OpenInput) OpenPath(path string)

OpenAttachment opens any file @ path using xdg-open

func (*OpenInput) OpenSelected

func (oi *OpenInput) OpenSelected()

OpenSelected opens whichever attachment is selected

func (*OpenInput) Previous

func (oi *OpenInput) Previous()

type SendPanel

type SendPanel struct {
	*tview.InputField
	// contains filtered or unexported fields
}

func NewSendPanel

func NewSendPanel(parent *ChatWindow, siggo *model.Siggo) *SendPanel

NewSendPanel creates a new SendPanel that is primarily a tview.InputField

func (*SendPanel) Clear

func (s *SendPanel) Clear()

func (*SendPanel) Defocus

func (s *SendPanel) Defocus()

func (*SendPanel) Send

func (s *SendPanel) Send()

func (*SendPanel) Update

func (s *SendPanel) Update()

type StatusBar

type StatusBar struct {
	*tview.TextView
	// contains filtered or unexported fields
}

func NewStatusBar

func NewStatusBar(parent *ChatWindow) *StatusBar

Jump to

Keyboard shortcuts

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