wrap

package
v0.45.2 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2026 License: Apache-2.0 Imports: 5 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)

This is the core wrapper for full content blocks. It streams line-by-line and emits wrapped segments directly into a buffer to avoid building large intermediate slices. When mp is true, it also records how wrapped rows map back to the original logical lines (Sp + Rv). That mapping is required for cursor/selection navigation in the UI, so we keep it optional to avoid extra work when it is not needed.

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