stimmtausch: github.com/makyo/stimmtausch/ui Index | Files

package ui

import "github.com/makyo/stimmtausch/ui"

Package ui provides the user interface for Stimmtausch.

Index

Package Files

doc.go history.go keybindings.go received_view.go ui.go

func New Uses

func New(c *client.Client) *tui

New instantiates a new Stimmtausch UI.

type History Uses

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

History represents a rolling buffer of lines used for input and output.

func NewHistory Uses

func NewHistory(max int) *History

NewHistory returns a new history buffer.

func (*History) AddPostWriteHook Uses

func (h *History) AddPostWriteHook(f func(*HistoryLine) error)

AddPostWriteHook accepts a function to be run whenever a write to the buffer succeeds.

func (*History) Back Uses

func (h *History) Back() *HistoryLine

Back moves the cursor back in time one line and returns the current line's content.

func (*History) Close Uses

func (h *History) Close() error

Close does nothing, and does it splendidly. Fulfills io.Closer

func (*History) Current Uses

func (h *History) Current() *HistoryLine

Current returns the current line in the buffer.

func (*History) Forward Uses

func (h *History) Forward() *HistoryLine

Forward moves the cursor forward in time one line and returns the current line's content.

func (*History) Last Uses

func (h *History) Last() *HistoryLine

Last moves the cursor to the last line.

func (*History) Size Uses

func (h *History) Size() int

func (*History) String Uses

func (h *History) String() string

String outputs the entire buffer as it stands.

func (*History) Write Uses

func (h *History) Write(line []byte) (int, error)

Write accepts a byte array and appends it to the buffer. It then executes every post-write hook. It returns the number of bytes written and any errors that occured. Fulfills io.Writer

type HistoryLine Uses

type HistoryLine struct {
    Timestamp time.Time
    Text      string
}

HistoryLine represents a timestamped line of text.

Package ui imports 14 packages (graph) and is imported by 1 packages. Updated 2020-08-03. Refresh now. Tools for package owners.