wordwrap

package
v1.0.95 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2023 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	FixedMaxWidth              int    // FixedMaxWidth maximum width of line / length at which newline should be inserted
	DynamicMaxWidth            bool   // DynamicMaxWidth if true, detect terminal max width before every wrap
	Padding                    string // Padding string to pad wrapped lines with. Eg. "  " for 2-space indent
	EscapeNewlineStringLiteral bool   // EscapeNewlineStringLiteral For `"long strings like this"`, indicates whether inserted newlines should be prefixed with ` \`
}

Options options for a word wrapper

type Wrapper

type Wrapper interface {
	WrapTo(s string, maxWidth int) string
	Wrap(s string) string
}

func New

func New(opts ...func(*Options)) Wrapper

Jump to

Keyboard shortcuts

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