Releases: galactixx/stringwrap
Releases · galactixx/stringwrap
v1.0.4
v1.0.4 — 2025-06-21 “Unicode Whitespaces & Docs”
Highlights
-
🔒 Robust‑whitespace support
- Added hard‑break handling for
\r,U+0085(NEL),U+2028(LS) andU+2029(PS). - Zero‑width control blanks
\vand\fare now ignored (no stray control bytes in output). - All other Unicode space separators (
U+1680,U+2000–U+200A,U+202F,U+205F,U+3000) are preserved as visible blanks with correctrunewidthaccounting (U+3000= 2 columns).
- Added hard‑break handling for
-
🛡️ Safety fixes
writeTabToLinenow guards againsttabSize == 0; prevents modulo‑zero panic.isWordyGraphemecorrectly classifies combining‑mark‑only clusters.
-
📝 Documentation & API comments
- Expanded docstrings for
StringWrapandStringWrapSplit, clarifying continued use of grapheme parsing for accurate width (e.g., ZWJ emojis). - Added inline commentary detailing whitespace classification logic.
- Expanded docstrings for
-
🧪 New test coverage
- Four fixtures covering legacy whitespace (
\r,U+2028,\v, and long‑word split withU+000B).
- Four fixtures covering legacy whitespace (
-
🔧 Small clean‑ups
- Consolidated whitespace
switch: special‑cases first, singledefaultfor printable blanks. - Eliminated redundant
runewidth.StringWidthcall in theiter()word‑split helper, reducing extra scans on oversized words. - Added performance notes; core algorithm unchanged.
- Consolidated whitespace
No breaking API changes. Previous tag checksums remain valid.
v1.0.3
v1.0.3 — 2025-05-08 “Whitespace Toggle”
-
✂️ User‑selectable trimming
-
Added
trimWhitespace boolparameter to bothStringWrapandStringWrapSplit.- Prior versions always stripped leading/trailing blanks; callers can now
choose to preserve them by passingfalse.
- Prior versions always stripped leading/trailing blanks; callers can now
-
Default behaviour remains unchanged (
true), so upgrading users who relied
on trimming need no code changes.
-
-
🧪 Tests
- Added positive/negative fixtures verifying correct behaviour when
trimWhitespaceis toggled and when lines begin with tabs/spaces.
- Added positive/negative fixtures verifying correct behaviour when
Minor breaking note: Function signatures changed; update importers that use
manual wrappers or reflection.
v1.0.2
v1.0.2 — 2025-05-07 “Metadata + ANSI”
-
🆕 Metadata enhancement
- Added
LastSegmentInOrig boolto theWrappedStringstruct, signalling when a wrapped segment is the final segment originating from its source line.
- Added
-
🌈 ANSI traversal
- Integrated
github.com/galactixx/ansiwalkerfor efficient iteration over ANSI escape sequences; codes are now skipped without contributing to width or disrupting grapheme parsing.
- Integrated
-
🔨 Internal refactors
- Updated main parsing loop to leverage ansiwalker; no behavioural changes beyond more reliable ANSI handling.
No breaking changes — addition to the struct is backward‑compatible.
v1.0.1 – Initial Release
v1.0.1 — 2025-05-07 “Initial Release”
-
🎉 First public version featuring:
- Unicode‑aware wrapping with grapheme parsing and accurate display‑width via
go-runewidth. - Optional word‑splitting with safe grapheme‑boundary hyphenation.
- ANSI escape‑sequence preservation (ignored for width).
- Tab expansion, trim‑whitespace option, and per‑line metadata (
WrappedStringSeq). - Basic benchmark and unit‑test suite.
- Unicode‑aware wrapping with grapheme parsing and accurate display‑width via
Stable foundation published to start community adoption.