rowtext

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package rowtext lays out the text of one row of cells across the columns on screen, as Sheets does: values formatted and aligned, text running on into blank neighbors, cut to column boundaries in a single pass. It reads the sheet and nothing else, so drawing the grid can be measured and tested on its own.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Span

type Span struct {
	Lead  int
	Text  string
	Trail int
	Style sheet.Style
	Owner int // column of the cell the text belongs to

	// Left for the caller to fill in from the owner's value.
	Link  string // the owner's link target, drawn as a hyperlink
	Error bool   // the owner shows an error: its text gets the error mark
}

Span is what one grid column shows in a row: blank columns, the text, blank columns. Only the text takes the owning cell's text style, so an underline doesn't run into the padding.

func Layout

func Layout(s *sheet.Sheet, row, lo, ncols, minCol, maxCol int) []Span

Layout lays out ncols columns of row from lo, each span exactly its column's width. Text may run in from columns between minCol and maxCol, so it stops at the frozen columns' divider. Values are formatted with their cell's number format and aligned as Sheets does: numbers right, text left, booleans and errors centered, unless the cell sets an alignment. Text runs on into blank neighbors: to the right when left-aligned, to the left when right-aligned, both ways when centered. It can come from cells outside the viewport, so the scan starts at the nearest filled cell on each side.

Jump to

Keyboard shortcuts

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