frame

package
v1.7.2 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package frame is a simple implementation on switching across cursor on terminal, based on ANSI.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Frame

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

Frame is the frame of a terminal output, it will control the position of cursor on terminal. Based on ANSI-CSI escape codes.

func NewFrame

func NewFrame(writer io.Writer) *Frame

NewFrame will initialize a new frame.

func (*Frame) Append

func (f *Frame) Append() *Line

Append will append a new line in the frame.

func (*Frame) HideCursor

func (f *Frame) HideCursor() error

HideCursor will hide cursor.

func (*Frame) Render

func (f *Frame) Render(line int, msg string) error

Render will write message on the specific line.

func (*Frame) ShowCursor

func (f *Frame) ShowCursor() error

ShowCursor will show cursor.

type Line

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

Line represents one line on the terminal frame.

func NewLine

func NewLine(frame *Frame, num int) *Line

NewLine will initialize a new line.

func (*Line) Clear

func (l *Line) Clear() error

Clear will clear the whole line.

func (*Line) Render

func (l *Line) Render(msg string) error

Render will render msg on the current line, if msg contains multiple lines, print in the next lines.

Jump to

Keyboard shortcuts

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