wrap

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const ContinuationUnit = "  "

Variables

This section is empty.

Functions

func Line

func Line(ctx context.Context, s string, w int, m Mode) ([]string, bool)

Types

type Mode

type Mode uint8
const (
	Plain Mode = iota
	Structured
	Pre
)

type Res

type Res struct {
	S  string
	Sp []Span
	Rv []int
}

func Wrap

func Wrap(ctx context.Context, s string, w int, m Mode, mp bool) (Res, bool)

Wrap is the core wrapper for full content blocks. It streams line by line and writes rows straight into a buffer rather than building large intermediate slices. When mp is true it also records how wrapped rows map back to the original logical lines (Sp and Rv). The UI needs that mapping to move a cursor and a selection, so it stays optional and the extra work is skipped when no caller wants it.

type Span

type Span struct {
	S int
	E int
}

Jump to

Keyboard shortcuts

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