textruns

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: Apache-2.0 Imports: 1 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package textruns splits a text at its spans' byte offsets, so a backend that draws a text span by span sees the bytes, style and link of each run.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Input

type Input struct {
	Text  string
	Spans []driver.TextSpan
	Style driver.TextStyle
}

Input is the text a backend splits: its bytes, the spans over them and the style the text takes where no span says otherwise.

type Run

type Run struct {
	Start, End int
	Text       string
	Style      driver.TextStyle
	Link       bool
	Hidden     bool
	Background driver.TextBackground
}

Run is one run of the text: bytes [Start, End), the span that styles them, or the text's own style in a gap.

func Split

func Split(in Input) []Run

Split returns in's text split at its spans' offsets, in order. A gap takes the text's style; a span starting before the text or inside the one before is clipped to what is left, and one ending past the text to its end.

Jump to

Keyboard shortcuts

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