v0.0.0-...-aadac20 Latest Latest

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

Go to latest
Published: Feb 17, 2024 License: MIT Imports: 15 Imported by: 0



Package ui provides the user interface for Stimmtausch.



This section is empty.


This section is empty.


func New

func New(c *client.Client) *tui

New instantiates a new Stimmtausch UI.


type History

type History struct {
	// contains filtered or unexported fields

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

func NewHistory

func NewHistory(max int, allowFragments bool) *History

NewHistory returns a new history buffer.

func (*History) AddPostWriteHook

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

func (h *History) Back() *HistoryLine

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

func (*History) Close

func (h *History) Close() error

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

func (*History) Current

func (h *History) Current() *HistoryLine

Current returns the current line in the buffer.

func (*History) Forward

func (h *History) Forward() *HistoryLine

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

func (*History) Last

func (h *History) Last() *HistoryLine

Last moves the cursor to the last line.

func (*History) Size

func (h *History) Size() int

func (*History) String

func (h *History) String() string

String outputs the entire buffer as it stands.

func (*History) Write

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

type HistoryLine struct {
	Timestamp time.Time
	Text      string

HistoryLine represents a timestamped line of text.

Jump to

Keyboard shortcuts

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