Skip to main content

Module column_widths

Module column_widths 

Source
Expand description

The width each column of the main table is drawn at, kept by column identity so the layout holds still while the view pages, scrolls, reorders and resizes.

An automatic width is learned from the first page a column is drawn on, from values the renderer formats anyway: nothing is read for it. Text keeps that width on later pages, bounded by text_cap, and a longer value is clipped behind the marker. A number, date or flag can’t be clipped without reading as another value, so its width only grows, to the widest value seen. Widths set by hand in the Columns sidebar outrank both.

A deliberate change to what the view shows (a query, reshape, drill, sort or filter) learns every automatic width again, from the first rows the new view reads. Paging and scrolling never do.

Structs§

ColumnWidths
Display widths by column identity: a name and its type. A column whose type changes, as a query or reading it as text can do, is a new column and starts afresh; one that comes back with its type keeps its width. Separate from the footer’s byte estimate, which plans the buffer and says nothing about cells.
PageMeasure
One column measured on the rows on screen, in cells, as the table draws it.

Enums§

WidthChoice
How a column’s width is chosen.

Constants§

MAX_WIDTH
MIN_WIDTH
The narrowest and widest a width set by hand may be.
UNSEEN_WIDTH
Where narrower or wider starts on a column that has not been drawn yet.
WIDTH_STEP
Cells one narrower or wider press moves a width.

Functions§

text_cap
The most cells an automatic width gives text or a heading: two fifths of the terminal (32 at 80 columns, 48 at 120), between 16 and 64. Taken from the terminal rather than the table, so opening a sidebar moves no column; a resize moves them, as it should.