Expand description
Pure cell formatting: numbers, dates, strings, booleans, filter matching.
All functions here are intentionally GPUI-free so they can be reused for
exports, server-side previews, and tests. The widget layer calls
format_cell on every visible cell during paint and on every
clipboard-copy; tests below document the public behavior.
Functions§
- alignment_
for - cell_
matches_ filter - Case-insensitive substring filter against the user-visible rendered text. Empty filter always matches.
- format_
cell - Format any cell into the user-visible text plus a “is negative” flag that lets paint code color it red without re-parsing the text.
- format_
date - Format a Unix timestamp (seconds). When
fmt.relativeis set, the result is a “2 days ago” / “in 3 weeks” string relative toSystemTime::now(); useformat_date_atto inject a frozen clock for tests. - format_
date_ at - Same as
format_datebut with an explicitnowtimestamp so tests can pin the relative-date output to a known clock. - format_
integer - Format a
CellValue::Integeragainst aNumberFormatwithout first casting throughf64. This preserves fulli64precision for values larger than2^53. - format_
number - Format a
f64against aNumberFormat. Negative formatting (parentheses vs leading minus) and thousands separators are driven by the format options. - format_
relative_ date - format_
string - Format text according to a
StringFormat: case, length, truncation.