termwrap

package
v0.5.10 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package termwrap is a helper to wrap long longs of text broken up at word boundaries based on the size of the parent terminal.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TermWrap

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

TermWrap manages the current size of the parent terminal.

func NewTermWrap

func NewTermWrap(defaultWidth, defaultHeight int) *TermWrap

NewTermWrap creates a new TermWrap with the size of the parent terminal or default values if the size is unknown.

func (*TermWrap) IndentedParagraph

func (tw *TermWrap) IndentedParagraph(prefix, content string, minimumWidth int) string

IndentedParagraph wraps the content at word boundaries indent by the prefix if-and-only-if the current terminal width is at _least_ of a minimumWidth. If it is not, then it does not indent the content and makes full use of the width.

func (*TermWrap) Paragraph

func (tw *TermWrap) Paragraph(content string) string

Paragraph wraps the content at word boundaries.

Jump to

Keyboard shortcuts

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