Stringwrap – Unicode-accurate text wrapper for Go (ANSI-aware, emoji-safe)

I am a little late with this since the initial version was published a month and a half ago, but I’ve just cut v1.0.4 of stringwrap, a small library that solves the annoying parts of wrapping text in terminals & TUIs:

  • Grapheme-aware: never splits :woman_technologist:, flags, or combining-mark sequences.
  • True display width: uses go-runewidth, handles full-width CJK, thin spaces, etc.
  • ANSI friendly: escape codes are preserved but don’t count toward width.
  • Tabs, trim, word-splitting: choose to keep or trim leading/trailing whitespace, expand tabs, hyphenate long words safely.
  • Rich metadata: every wrapped line comes with byte/rune offsets back into the original string in addition to other metadata.

Repo & docs

Would love feedback, bug reports, or ideas for niceties like stream-based wrapping. Thanks for checking it out! :folded_hands: