decoration

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2025 License: MIT Imports: 9 Imported by: 1 module, 1 package

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Background

type Background struct {
	// Color for background.
	Color color.Color
}

type Border

type Border struct {
	// Color for the stroke.
	Color color.Color
}

type Decoration

type Decoration struct {
	// Source marks where the decoration is from.
	Source any
	// Priority configures the painting order of the decoration.
	// TODO.
	Priority int
	// Start and End are rune offset in the document.
	Start, End    int
	Background    *Background
	Underline     *Underline
	Squiggle      *Squiggle
	Strikethrough *Strikethrough
	Border        *Border
	Italic        bool
	Bold          bool
}

Decoration defines APIs each concrete decorations should implement. A decoration represents styles sharing between a range of text.

type DecorationTree

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

DecorationTree leverages a interval tree to stores overlapping decorations.

func NewDecorationTree

func NewDecorationTree() *DecorationTree

func (*DecorationTree) Insert

func (d *DecorationTree) Insert(decos ...Decoration)

Insert a new decoration range. start and end are offset in rune in the document.

func (*DecorationTree) Query

func (d *DecorationTree) Query(pos int) []Decoration

Query returns all styles at a given character offset

func (*DecorationTree) QueryRange

func (d *DecorationTree) QueryRange(start, end int) []Decoration

QueryRange returns all segments overlapping the range

func (*DecorationTree) RemoveAll

func (d *DecorationTree) RemoveAll()

func (*DecorationTree) RemoveBySource

func (d *DecorationTree) RemoveBySource(source string) error

func (*DecorationTree) Split

func (t *DecorationTree) Split(line *layout.Line, runs *[]painter.RenderRun)

Split implements painter.LineSplitter

type Squiggle

type Squiggle struct {
	// Color for the stroke.
	Color color.Color
}

type Strikethrough

type Strikethrough struct {
	// Color for the stroke.
	Color color.Color
}

type Underline

type Underline struct {
	// Color for the stroke.
	Color color.Color
}

Jump to

Keyboard shortcuts

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