frontend

package
v0.2.1-0...-dabd69d Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2017 License: MIT Imports: 13 Imported by: 1

Documentation

Index

Constants

View Source
const SelectionInputMaxSize = 10

The amount of rows at max that can be in the selection input

Variables

View Source
var BottomPadding = 2

The amount of lines at the bottom of the window to leave available for status bars. One line for the status bar One line for the command bar

View Source
var INFO_PAGE = fmt.Sprintf(`
Slick %s

By Ryan Gaus and contributors.
Open source and MIT licensed.
type '/q' to exit
type '/connect "slack token"' to connect to a slack team
type '/help' to learn more
(no slack teams are currently connected.)
`, version.Version())

Functions

func ParseMarkdown

func ParseMarkdown(text string) gateway.PrintableMessage

func ParseSlackMessage

func ParseSlackMessage(text string, printableMessage *gateway.PrintableMessage, UserById func(string) (*gateway.User, error)) error

Given a string to be displayed in the ui, tokenize the message and return a *PrintableMessage that contains each part as a token.

Types

type AsciiScreen

type AsciiScreen struct {
	Content [][]rune
	Width   int
	Height  int
}

This screen implements the `tcell.Screen` interface, which means that it can be drawn to instead of the actual screen for tests. In addition, it also has both a `.Compare` and `.Print` method.

The `.Compare` method takes the path to a test file, and returnns a diff between the screen contents and the text file. For example: diff, ok := screen.Compare("foo.txt")

if ok {
	fmt.Println("Diff is empty!")
} else {
	fmt.Println("There are differences:\n", diff)
}

The `.Print` method logs the current contents of the screen to stdout, via `fmt.Println`. It takes no arguments.

func NewAsciiScreen

func NewAsciiScreen() *AsciiScreen

func (AsciiScreen) CanDisplay

func (screen AsciiScreen) CanDisplay(r rune, checksFallback bool) bool

func (AsciiScreen) CharacterSet

func (screen AsciiScreen) CharacterSet() string

func (AsciiScreen) Clear

func (screen AsciiScreen) Clear()

func (AsciiScreen) Colors

func (screen AsciiScreen) Colors() int

func (AsciiScreen) Compare

func (screen AsciiScreen) Compare(filename string) (string, bool)

func (AsciiScreen) DisableMouse

func (screen AsciiScreen) DisableMouse()

func (AsciiScreen) EnableMouse

func (screen AsciiScreen) EnableMouse()

func (AsciiScreen) Fill

func (screen AsciiScreen) Fill(r rune, s tcell.Style)

func (AsciiScreen) Fini

func (screen AsciiScreen) Fini()

func (AsciiScreen) GetContent

func (screen AsciiScreen) GetContent(x int, y int) (mainc rune, combc []rune, style tcell.Style, width int)

func (AsciiScreen) HasKey

func (screen AsciiScreen) HasKey(key tcell.Key) bool

func (AsciiScreen) HasMouse

func (screen AsciiScreen) HasMouse() bool

func (AsciiScreen) HideCursor

func (screen AsciiScreen) HideCursor()

func (AsciiScreen) Init

func (screen AsciiScreen) Init() error

func (AsciiScreen) PollEvent

func (screen AsciiScreen) PollEvent() tcell.Event

func (AsciiScreen) PostEvent

func (screen AsciiScreen) PostEvent(ev tcell.Event) error

func (AsciiScreen) PostEventWait

func (screen AsciiScreen) PostEventWait(ev tcell.Event)

func (AsciiScreen) Print

func (screen AsciiScreen) Print()

func (AsciiScreen) RegisterRuneFallback

func (screen AsciiScreen) RegisterRuneFallback(r rune, substr string)

func (AsciiScreen) Resize

func (screen AsciiScreen) Resize(a, b, c, d int)

func (AsciiScreen) SetCell

func (screen AsciiScreen) SetCell(x int, y int, style tcell.Style, ch ...rune)

func (AsciiScreen) SetContent

func (screen AsciiScreen) SetContent(x int, y int, mainc rune, combc []rune, style tcell.Style)

func (AsciiScreen) SetStyle

func (screen AsciiScreen) SetStyle(style tcell.Style)

func (AsciiScreen) Show

func (screen AsciiScreen) Show()

func (AsciiScreen) ShowCursor

func (screen AsciiScreen) ShowCursor(x int, y int)

func (AsciiScreen) Size

func (screen AsciiScreen) Size() (i int, j int)

func (AsciiScreen) Sync

func (screen AsciiScreen) Sync()

func (AsciiScreen) UnregisterRuneFallback

func (screen AsciiScreen) UnregisterRuneFallback(r rune)

type TerminalDisplay

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

func NewTerminalDisplay

func NewTerminalDisplay(screen tcell.Screen) *TerminalDisplay

func (*TerminalDisplay) Close

func (term *TerminalDisplay) Close()

func (*TerminalDisplay) DrawBlankLine

func (term *TerminalDisplay) DrawBlankLine(line int)

Given a line number, reset it to the default style and erase it.

func (*TerminalDisplay) DrawBlankLines

func (term *TerminalDisplay) DrawBlankLines(start int, end int)

func (*TerminalDisplay) DrawCommandBar

func (term *TerminalDisplay) DrawCommandBar(
	command string,
	cursorPosition int,
	currentChannel *gateway.Channel,
	currentTeamName string,
	isOffline bool,
	config map[string]string,
)

func (*TerminalDisplay) DrawInfoPage

func (term *TerminalDisplay) DrawInfoPage()

Render above launch info when the user isn't conencted to an active connection.

func (*TerminalDisplay) DrawMessages

func (term *TerminalDisplay) DrawMessages(
	messages []gateway.Message,
	selectedMessageIndex int,
	bottomDisplayedItem int,
	userById func(string) (*gateway.User, error),
	userOnline func(user *gateway.User) bool,
	config map[string]string,
) (renderedMessageNumber int, renderedAllMessages bool)

Draw message history in the channel

func (*TerminalDisplay) DrawModal

func (term *TerminalDisplay) DrawModal(title string, body string, scrollPosition int, editable bool)

func (*TerminalDisplay) DrawSelectionInput

func (term *TerminalDisplay) DrawSelectionInput(
	preItems []string,
	selectedIndex int,
	bottomDisplayedItem int,
	rank func(string) int,
	config map[string]string,
)

func (*TerminalDisplay) DrawStatusBar

func (term *TerminalDisplay) DrawStatusBar(
	mode string,
	connections []gateway.Connection,
	activeConnection gateway.Connection,
	stat status.Status,
	config map[string]string,
)

func (*TerminalDisplay) Render

func (term *TerminalDisplay) Render()

func (*TerminalDisplay) Screen

func (term *TerminalDisplay) Screen() tcell.Screen

func (*TerminalDisplay) WriteParagraphStyle

func (term *TerminalDisplay) WriteParagraphStyle(
	x int,
	y int,
	width int,
	height int,
	style tcell.Style,
	text string,
) (int, int)

func (*TerminalDisplay) WriteText

func (term *TerminalDisplay) WriteText(x int, y int, text string)

func (*TerminalDisplay) WriteTextStyle

func (term *TerminalDisplay) WriteTextStyle(x int, y int, style tcell.Style, text string)

Jump to

Keyboard shortcuts

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