promptui: Index | Files

package screenbuf

import ""


Package Files


type ScreenBuf Uses

type ScreenBuf struct {
    // contains filtered or unexported fields

ScreenBuf is a convenient way to write to terminal screens. It creates, clears and, moves up or down lines as needed to write the output to the terminal using ANSI escape codes.

func New Uses

func New(w io.Writer) *ScreenBuf

New creates and initializes a new ScreenBuf.

func (*ScreenBuf) Clear Uses

func (s *ScreenBuf) Clear() error

Clear clears all previous lines and the output starts from the top.

func (*ScreenBuf) Flush Uses

func (s *ScreenBuf) Flush() error

Flush writes any buffered data to the underlying io.Writer, ensuring that any pending data is displayed.

func (*ScreenBuf) Reset Uses

func (s *ScreenBuf) Reset()

Reset truncates the underlining buffer and marks all its previous lines to be cleared during the next Write.

func (*ScreenBuf) Write Uses

func (s *ScreenBuf) Write(b []byte) (int, error)

Write writes a single line to the underlining buffer. If the ScreenBuf was previously reset, all previous lines are cleared and the output starts from the top. Lines with \r or \n will cause an error since they can interfere with the terminal ability to move between lines.

func (*ScreenBuf) WriteString Uses

func (s *ScreenBuf) WriteString(str string) (int, error)

WriteString is a convenient function to write a new line passing a string. Check ScreenBuf.Write() for a detailed explanation of the function behaviour.

Package screenbuf imports 3 packages (graph) and is imported by 5 packages. Updated 2020-01-22. Refresh now. Tools for package owners.