INNER CODE UNIT · Go
func
jpbruinsslot/slack-term · components/chat.go:37
func (c *Chat) Buffer() termui.Buffer {
// Convert Messages into termui.Cell
cells := c.MessagesToCells(c.Messages)
// We will create an array of Line structs, this allows us
// to more easily render the items in a list. We will range
// over the cells we've created and create a Line within
// the bounds of the Chat pane
type Line struct {
cells []termui.Cell
}
lines := []Line{}
line := Line{}
// When we encounter a newline or, are at the bounds of the chat view we
// stop iterating over the cells and add the line to the line array
x := 0