Documentation ¶
Index ¶
- Constants
- Variables
- type ChannelItem
- type Channels
- func (c *Channels) Buffer() termui.Buffer
- func (c *Channels) FindChannel(channelID string) int
- func (c *Channels) GetHeight() int
- func (c *Channels) GetSelectedChannel() ChannelItem
- func (c *Channels) GotoPosition(newPos int)
- func (c *Channels) GotoPositionSearch(position int)
- func (c *Channels) Jump()
- func (c *Channels) MarkAsRead(channelID int)
- func (c *Channels) MarkAsUnread(channelID string)
- func (c *Channels) MoveCursorBottom()
- func (c *Channels) MoveCursorDown()
- func (c *Channels) MoveCursorTop()
- func (c *Channels) MoveCursorUp()
- func (c *Channels) ScrollDown()
- func (c *Channels) ScrollUp()
- func (c *Channels) Search(term string)
- func (c *Channels) SearchNext()
- func (c *Channels) SearchPrev()
- func (c *Channels) SetChannels(channels []ChannelItem)
- func (c *Channels) SetPresence(channelID string, presence string)
- func (c *Channels) SetSelectedChannel(index int)
- func (c *Channels) SetWidth(w int)
- func (c *Channels) SetX(x int)
- func (c *Channels) SetY(y int)
- type Chat
- func (c *Chat) AddMessage(message Message)
- func (c *Chat) AddReply(parentID string, message Message)
- func (c *Chat) Buffer() termui.Buffer
- func (c *Chat) ClearMessages()
- func (c *Chat) GetHeight() int
- func (c *Chat) GetMaxItems() int
- func (c *Chat) Help(usage string, cfg *config.Config)
- func (c *Chat) IsNewThread(parentID string) bool
- func (c *Chat) MessageToCells(msg Message) []termui.Cell
- func (c *Chat) MessagesToCells(msgs map[string]Message) []termui.Cell
- func (c *Chat) ScrollDown()
- func (c *Chat) ScrollUp()
- func (c *Chat) SetBorderLabel(channelName string)
- func (c *Chat) SetMessages(messages []Message)
- func (c *Chat) SetWidth(w int)
- func (c *Chat) SetX(x int)
- func (c *Chat) SetY(y int)
- type Debug
- type Input
- func (i *Input) Backspace()
- func (i *Input) Buffer() termui.Buffer
- func (i *Input) CalculateOffset() int
- func (i *Input) Clear()
- func (i *Input) Delete()
- func (i *Input) GetHeight() int
- func (i *Input) GetMaxWidth() int
- func (i *Input) GetRuneWidthLeft() int
- func (i *Input) GetRuneWidthOffsetToCursor() int
- func (i *Input) GetRuneWidthRight() int
- func (i *Input) GetText() string
- func (i *Input) Insert(key rune)
- func (i *Input) IsEmpty() bool
- func (i *Input) MoveCursorLeft()
- func (i *Input) MoveCursorRight()
- func (i *Input) ScrollLeft()
- func (i *Input) ScrollRight()
- func (i *Input) SetWidth(w int)
- func (i *Input) SetX(x int)
- func (i *Input) SetY(y int)
- type Message
- type Mode
- type Threads
Constants ¶
const ( IconOnline = "●" IconOffline = "○" IconChannel = "#" IconGroup = "☰" IconIM = "●" IconMpIM = "☰" IconNotification = "*" PresenceAway = "away" PresenceActive = "active" ChannelTypeChannel = "channel" ChannelTypeGroup = "group" ChannelTypeIM = "im" ChannelTypeMpIM = "mpim" )
const ( CommandMode = "NORMAL" InsertMode = "INSERT" SearchMode = "SEARCH" )
Variables ¶
var (
COLORS = []string{
"fg-black",
"fg-red",
"fg-green",
"fg-yellow",
"fg-blue",
"fg-magenta",
"fg-cyan",
"fg-white",
}
)
Functions ¶
This section is empty.
Types ¶
type ChannelItem ¶ added in v0.3.0
type ChannelItem struct { ID string Name string Topic string Type string UserID string Presence string Notification bool StylePrefix string StyleIcon string StyleText string }
func (ChannelItem) GetChannelName ¶ added in v0.3.0
func (c ChannelItem) GetChannelName() string
GetChannelName will return a formatted representation of the name of the channel
func (ChannelItem) ToString ¶ added in v0.3.0
func (c ChannelItem) ToString() string
ToString will set the label of the channel, how it will be displayed on screen. Based on the type, different icons are shown, as well as an optional notification icon.
type Channels ¶
type Channels struct { ChannelItems []ChannelItem List *termui.List SelectedChannel int // index of which channel is selected from the List Offset int // from what offset are channels rendered CursorPosition int // the y position of the 'cursor' SearchMatches []int // index of the search matches SearchPosition int // current position of a search match }
Channels is the definition of a Channels component
func CreateChannelsComponent ¶ added in v0.3.0
CreateChannels is the constructor for the Channels component
func (*Channels) FindChannel ¶ added in v0.4.1
func (*Channels) GetSelectedChannel ¶ added in v0.3.0
func (c *Channels) GetSelectedChannel() ChannelItem
Get SelectedChannel returns the ChannelItem that is currently selected
func (*Channels) GotoPosition ¶ added in v0.3.0
GotoPosition is used by to automatically scroll to a specific location in the channels component
func (*Channels) GotoPositionSearch ¶ added in v0.5.0
GotoPosition is used by the search functionality to automatically scroll to a specific location in the channels component
func (*Channels) Jump ¶ added in v0.5.0
func (c *Channels) Jump()
Jump to the first channel with a notification
func (*Channels) MarkAsRead ¶ added in v0.4.1
func (*Channels) MarkAsUnread ¶ added in v0.4.1
func (*Channels) MoveCursorBottom ¶
func (c *Channels) MoveCursorBottom()
MoveCursorBottom will move the cursor to the bottom of the channels
func (*Channels) MoveCursorDown ¶
func (c *Channels) MoveCursorDown()
MoveCursorDown will increase the SelectedChannel by 1
func (*Channels) MoveCursorTop ¶
func (c *Channels) MoveCursorTop()
MoveCursorTop will move the cursor to the top of the channels
func (*Channels) MoveCursorUp ¶
func (c *Channels) MoveCursorUp()
MoveCursorUp will decrease the SelectedChannel by 1
func (*Channels) ScrollDown ¶
func (c *Channels) ScrollDown()
ScrollDown enables us to scroll through the channel list when it overflows
func (*Channels) ScrollUp ¶
func (c *Channels) ScrollUp()
ScrollUp enables us to scroll through the channel list when it overflows
func (*Channels) Search ¶ added in v0.2.2
Search will search through the channels to find a channel, when a match has been found the selected channel will then be the channel that has been found
func (*Channels) SearchNext ¶ added in v0.3.0
func (c *Channels) SearchNext()
SearchNext allows us to cycle through the c.SearchMatches
func (*Channels) SearchPrev ¶ added in v0.3.0
func (c *Channels) SearchPrev()
SearchPrev allows us to cycle through the c.SearchMatches
func (*Channels) SetChannels ¶ added in v0.3.0
func (c *Channels) SetChannels(channels []ChannelItem)
func (*Channels) SetPresence ¶ added in v0.2.2
func (*Channels) SetSelectedChannel ¶
SetSelectedChannel sets the SelectedChannel given the index
type Chat ¶
Chat is the definition of a Chat component
func CreateChatComponent ¶ added in v0.3.0
CreateChatComponent is the constructor for the Chat struct
func (*Chat) AddMessage ¶
AddMessage adds a single message to Messages
func (*Chat) AddReply ¶ added in v0.5.0
AddReply adds a single reply to a parent thread, it also sets the thread separator
func (*Chat) GetMaxItems ¶ added in v0.3.0
GetMaxItems return the maximal amount of items can fit in the Chat component
func (*Chat) IsNewThread ¶ added in v0.5.0
IsNewThread check whether a message that is going to be added as a child to a parent message, is the first one or not
func (*Chat) MessageToCells ¶ added in v0.5.0
MessageToCells will convert a Message struct to termui.Cell
We're building parts of the message individually, or else DefaultTxBuilder will interpret potential markdown usage in a message as well.
func (*Chat) MessagesToCells ¶ added in v0.5.0
MessagesToCells is a wrapper around MessageToCells to use for a slice of of type Message
func (*Chat) ScrollDown ¶
func (c *Chat) ScrollDown()
ScrollDown will render the chat messages based on the Offset of the Chat pane.
Offset is 0 when scrolled down. (we loop backwards over the array, so we start with rendering last item in the list at the maximum y of the Chat pane). Increasing the Offset will thus result in substracting the offset from the len(Chat.Messages).
func (*Chat) ScrollUp ¶
func (c *Chat) ScrollUp()
ScrollUp will render the chat messages based on the Offset of the Chat pane.
Offset is 0 when scrolled down. (we loop backwards over the array, so we start with rendering last item in the list at the maximum y of the Chat pane). Increasing the Offset will thus result in substracting the offset from the len(Chat.Messages).
func (*Chat) SetBorderLabel ¶
SetBorderLabel will set Label of the Chat pane to the specified string
func (*Chat) SetMessages ¶ added in v0.3.0
SetMessages will put the provided messages into the Messages field of the Chat view
type Debug ¶ added in v0.3.0
Debug can be used to relay debugging information in the Debug component, see event.go on how to use it
func CreateDebugComponent ¶ added in v0.3.0
type Input ¶
type Input struct { Par *termui.Par Text []rune CursorPositionScreen int CursorPositionText int Offset int }
Input is the definition of an Input component
func CreateInputComponent ¶ added in v0.3.0
func CreateInputComponent() *Input
CreateInput is the constructor of the Input struct
func (*Input) Backspace ¶
func (i *Input) Backspace()
Backspace will remove a character in front of the CursorPositionText
func (*Input) CalculateOffset ¶ added in v0.3.0
CalculateOffset will, based on the width of the runes on the left of the text cursor, calculate the offset that needs to be used by the Inpute Component
func (*Input) Clear ¶
func (i *Input) Clear()
Clear will empty the input and move the cursor to the start position
func (*Input) Delete ¶
func (i *Input) Delete()
Delete will remove a character at the CursorPositionText
func (*Input) GetMaxWidth ¶ added in v0.3.0
GetMaxWidth returns the maximum number of positions the Input component can display
func (*Input) GetRuneWidthLeft ¶ added in v0.3.0
GetRuneWidthLeft will get the width of a rune on the left side of the CursorPositionText
func (*Input) GetRuneWidthOffsetToCursor ¶ added in v0.3.0
GetRunWidthOffsetToCursor will get the rune width of all the runes from the offset until the text cursor
func (*Input) GetRuneWidthRight ¶ added in v0.3.0
GetRuneWidthLeft will get the width of a rune on the right side of the CursorPositionText
func (*Input) Insert ¶
Insert will insert a given key at the place of the current CursorPositionText
func (*Input) MoveCursorLeft ¶
func (i *Input) MoveCursorLeft()
MoveCursorLeft will decrease the current CursorPositionText with 1
func (*Input) MoveCursorRight ¶
func (i *Input) MoveCursorRight()
MoveCursorRight will increase the current CursorPositionText with 1
func (*Input) ScrollLeft ¶ added in v0.3.0
func (i *Input) ScrollLeft()
func (*Input) ScrollRight ¶ added in v0.3.0
func (i *Input) ScrollRight()
type Message ¶ added in v0.3.0
type Message struct { ID string Messages map[string]Message Time time.Time Thread string Name string Content string StyleTime string StyleThread string StyleName string StyleText string FormatTime string }
func SortMessages ¶ added in v0.5.0
func (Message) GetContent ¶ added in v0.5.0
type Mode ¶
Mode is the definition of Mode component
func CreateModeComponent ¶ added in v0.3.0
func CreateModeComponent() *Mode
CreateMode is the constructor of the Mode struct
func (*Mode) SetCommandMode ¶ added in v0.3.0
func (m *Mode) SetCommandMode()
func (*Mode) SetInsertMode ¶ added in v0.3.0
func (m *Mode) SetInsertMode()
func (*Mode) SetSearchMode ¶ added in v0.3.0
func (m *Mode) SetSearchMode()