widget

package
v1.0.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseIRCStyles

func ParseIRCStyles(c []ui.Cell) []ui.Cell

func WrapCellsPadded

func WrapCellsPadded(cells []ui.Cell, width uint, leftPadding int) []ui.Cell

Types

type ActivityType

type ActivityType int
const TabHasActivity ActivityType = 0
const TabHasNotice ActivityType = 1

type ChatPane

type ChatPane struct {
	ui.Block
	Rows        []string
	WrapText    bool
	TextStyle   ui.Style
	SelectedRow int
	LeftPadding int

	ModeText  string
	ModeStyle ui.Style

	SubTitle      string
	SubTitleStyle ui.Style
}

A ChatPane contains the messages for the screen. This widget is based on the termui List widget. ChatPanes support both termui formatting as well as IRC formatting.

func NewChatPane

func NewChatPane() *ChatPane

func (*ChatPane) Draw

func (cp *ChatPane) Draw(buf *ui.Buffer)

type InputMode

type InputMode int

InputMode defines different kinds of input handled by a ModedTextInput.

const (
	// Regular text.
	ModeMessage InputMode = iota
	// A command and arguments separated by spaces.
	ModeCommand
)

type ModedText

type ModedText struct {
	Kind InputMode
	Text string
}

ModedText is some text with an editing mode specified.

type ModedTextInput

type ModedTextInput struct {
	TextInput
	// contains filtered or unexported fields
}

A ModedTextInput tracks the current editing mode of a TextInput.

func NewModedTextInput

func NewModedTextInput() *ModedTextInput

NewModedTextInput creates a new ModedTextInput.

func (*ModedTextInput) Backspace

func (i *ModedTextInput) Backspace()

func (*ModedTextInput) Consume

func (i *ModedTextInput) Consume() ModedText

Consume returns and clears the ModedText in the ModedTextInput.

func (*ModedTextInput) Mode

func (i *ModedTextInput) Mode() InputMode

Mode returns the current editing mode.

func (*ModedTextInput) Set

func (i *ModedTextInput) Set(in ModedText)

func (*ModedTextInput) ToggleMode

func (i *ModedTextInput) ToggleMode()

ToggleMode switches between the editing modes.

type StatusBarPane

type StatusBarPane struct {
	*widgets.TabPane

	TabsWithActivity map[int]ActivityType
	NoticeStyle      ui.Style
	ActivityStyle    ui.Style
}

StatusBarPane contains the tabs for available windows. This widget compounds a termui TabPane widget with highlighting of tabs in two additional ways: notice and activity. Notice is intended for when a tab wants extra attention (ie. user was mentioned) vs activity where there are just some new lines since last touched.

func NewStatusBarPane

func NewStatusBarPane() *StatusBarPane

func (*StatusBarPane) Draw

func (sb *StatusBarPane) Draw(buf *ui.Buffer)

type TextInput

type TextInput struct {
	ui.Block
	Text      string
	TextStyle ui.Style
	WrapText  bool

	// If specified, called during Reset and the result is used
	// as the initial text in the text box.
	Prefix func() string
	// contains filtered or unexported fields
}

A TextInput is a widget with editable contents. This widget is based on the termui Paragraph widget.

func NewTextInput

func NewTextInput() *TextInput

func (*TextInput) Append

func (i *TextInput) Append(in string)

Append adds the given string to the end of the editable content.

func (*TextInput) Backspace

func (i *TextInput) Backspace()

Backspace removes the previous character from the current position of the editable content.

func (*TextInput) Consume

func (i *TextInput) Consume() string

Consume returns and clears the current input in the TextInput.

func (*TextInput) CursorEndLine

func (i *TextInput) CursorEndLine()

func (*TextInput) CursorNext

func (i *TextInput) CursorNext()

func (*TextInput) CursorNextWord

func (i *TextInput) CursorNextWord()

func (*TextInput) CursorPrev

func (i *TextInput) CursorPrev()

func (*TextInput) CursorPrevWord

func (i *TextInput) CursorPrevWord()

func (*TextInput) CursorStartLine

func (i *TextInput) CursorStartLine()

func (*TextInput) DeleteNext

func (i *TextInput) DeleteNext()

DeleteNext removes the next character from the current position of the editable content.

func (*TextInput) Draw

func (i *TextInput) Draw(buf *ui.Buffer)

func (*TextInput) Len

func (i *TextInput) Len() int

Len returns the length of the contents of the TextInput.

func (*TextInput) Peek

func (i *TextInput) Peek() string

Peek returns the current input in the TextInput without clearing.

func (*TextInput) Pos

func (i *TextInput) Pos() int

Pos returns the cursor position in the contents of the TextInput.

func (*TextInput) Reset

func (i *TextInput) Reset()

Reset the contents of the TextInput.

type UserList

type UserList struct {
	ui.Block
	Rows        []string
	TextStyle   ui.Style
	SelectedRow int
}

A UserList contains a list of users on a channel. This widget is based on the termui Table widget.

func NewUserList

func NewUserList() *UserList

func (*UserList) Draw

func (ul *UserList) Draw(buf *ui.Buffer)

Jump to

Keyboard shortcuts

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