Documentation
¶
Overview ¶
Package chunk places cache-friendly boundaries within a single logical line of text. Callers use each chunk's bytes as the key of a per-chunk segmentation cache: an edit confined to one chunk re-segments only that chunk rather than the whole line.
Every boundary is at once a UAX #29 grapheme boundary, a UAX #29 word boundary, and a UAX #14 line-break opportunity. Cuts fall only at breakable whitespace or sentence terminators, are snapped past trailing combining marks and format characters, and are placed only where the next chunk begins with letter or number content. That keeps per-chunk segmentation equal to whole-line segmentation for all three boundary kinds — a cut landing mid-segment would inject a boundary the whole-line pass would not have. Boundary placement is a pure function of the input; it is independent of width, wrap mode, and any layout state.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendBoundaries ¶
AppendBoundaries appends to dst the exclusive end byte offset of each chunk of s and returns the extended slice. The chunks partition s: chunk i spans s[start:b[i]] where b is the appended boundaries, start is the previous boundary, and 0 for the first chunk. The last appended boundary is always len(s). An empty s yields a single boundary of 0 (one empty chunk).
Types ¶
This section is empty.