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
// Invalid is set when the owner fails its data validation: its text
// gets the invalid mark.
Invalid bool
}
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 ¶
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.