Skip to content

Releases: galactixx/stringwrap

v1.0.4

21 Jun 22:28

Choose a tag to compare

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) and U+2029 (PS).
    • Zero‑width control blanks \v and \f are now ignored (no stray control bytes in output).
    • All other Unicode space separators (U+1680, U+2000U+200A, U+202F, U+205F, U+3000) are preserved as visible blanks with correct runewidth accounting (U+3000 = 2 columns).
  • 🛡️ Safety fixes

    • writeTabToLine now guards against tabSize == 0; prevents modulo‑zero panic.
    • isWordyGrapheme correctly classifies combining‑mark‑only clusters.
  • 📝 Documentation & API comments

    • Expanded docstrings for StringWrap and StringWrapSplit, clarifying continued use of grapheme parsing for accurate width (e.g., ZWJ emojis).
    • Added inline commentary detailing whitespace classification logic.
  • 🧪 New test coverage

    • Four fixtures covering legacy whitespace (\r, U+2028, \v, and long‑word split with U+000B).
  • 🔧 Small clean‑ups

    • Consolidated whitespace switch: special‑cases first, single default for printable blanks.
    • Eliminated redundant runewidth.StringWidth call in the iter() word‑split helper, reducing extra scans on oversized words.
    • Added performance notes; core algorithm unchanged.

No breaking API changes. Previous tag checksums remain valid.

v1.0.3

21 Jun 22:27

Choose a tag to compare

v1.0.3 — 2025-05-08  “Whitespace Toggle”

  • ✂️ User‑selectable trimming

    • Added trimWhitespace bool parameter to both StringWrap and StringWrapSplit.

      • Prior versions always stripped leading/trailing blanks; callers can now
        choose to preserve them by passing false.
    • 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
      trimWhitespace is toggled and when lines begin with tabs/spaces.

Minor breaking note: Function signatures changed; update importers that use
manual wrappers or reflection.

v1.0.2

21 Jun 22:24

Choose a tag to compare

v1.0.2 — 2025-05-07  “Metadata + ANSI”

  • 🆕 Metadata enhancement

    • Added LastSegmentInOrig bool to the WrappedString struct, signalling when a wrapped segment is the final segment originating from its source line.
  • 🌈 ANSI traversal

    • Integrated github.com/galactixx/ansiwalker for efficient iteration over ANSI escape sequences; codes are now skipped without contributing to width or disrupting grapheme parsing.
  • 🔨 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

21 Jun 22:17

Choose a tag to compare

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.

Stable foundation published to start community adoption.