Skip to content

Releases: unilibs/uniwidth

v0.1.0 - First Stable Release 🎉

22 Nov 13:18

Choose a tag to compare

After 35 days of beta testing, uniwidth v0.1.0 is now stable and ready for production use.

🚀 Performance

3.9-46x faster than go-runewidth with zero allocations:

  • ASCII strings: 15-46x faster
  • CJK strings: 4-14x faster
  • Mixed/Emoji strings: 6-8x faster

✨ Key Features

  • 🎯 Unicode 16.0 support with full compliance
  • 💎 Zero allocations for ASCII-only strings (no GC pressure)
  • 🧵 Thread-safe (immutable design, no global state)
  • 📊 Tiered lookup strategy (O(1) for 90-95% of cases)
  • 🔧 Options API for East Asian Width configuration
  • Proper handling of variation selectors and regional indicators (flags)

📊 Quality Metrics

  • Test Coverage: 90.3% (exceeds 90% target ✅)
  • Tests: 100% passing on Linux, macOS, Windows
  • Linter: 0 issues (golangci-lint with 34+ linters)
  • Race Detector: 0 data races
  • Dependencies: Zero external dependencies (pure stdlib)

📦 Installation

go get github.com/unilibs/uniwidth@v0.1.0

Requirements: Go 1.25 or later

🔧 Quick Start

package main

import (
    "fmt"
    "github.com/unilibs/uniwidth"
)

func main() {
    // Calculate width of a string
    width := uniwidth.StringWidth("Hello 世界")
    fmt.Println(width) // Output: 10

    // East Asian locale (ambiguous characters are wide)
    opts := []uniwidth.Option{
        uniwidth.WithEastAsianAmbiguous(uniwidth.EAWide),
    }
    width = uniwidth.StringWidthWithOptions("±½", opts...)
    fmt.Println(width) // Output: 4
}

📋 What's Changed Since Beta

Fixed (from v0.1.0-beta)

  • ✅ All conformance tests passing (Unicode edge cases resolved)
  • ✅ Increased test coverage: 87.1% → 90.3%
  • ✅ Added comprehensive project governance files

Added

  • ✅ CODE_OF_CONDUCT.md (Contributor Covenant v2.1)
  • ✅ CONTRIBUTING.md (Git-Flow workflow, contribution guidelines)
  • ✅ SECURITY.md (security policy and best practices)
  • ✅ .github/CODEOWNERS (code ownership definition)
  • ✅ scripts/pre-release-check.sh (automated quality validation)
  • ✅ Git-Flow workflow support in CI/CD

Quality Improvements

  • ✅ Coverage increased to 90.3% with new test cases
  • ✅ All linter warnings resolved
  • ✅ Code formatting enforced across all files

🎯 Use Cases

Perfect for:

  • TUI frameworks (terminal rendering hot paths)
  • Terminal emulators (text layout calculations)
  • CLI tools (table alignment, formatting)
  • Text editors (cursor positioning, column calculation)

🔄 Migration from go-runewidth

Drop-in replacement with 3.9-46x performance boost:

// Before (go-runewidth)
import "github.com/mattn/go-runewidth"
width := runewidth.StringWidth(s)

// After (uniwidth) - zero code changes!
import "github.com/unilibs/uniwidth"
width := uniwidth.StringWidth(s)

📚 Documentation

🙏 Special Thanks

Professor Ancha Baranova - This project would not have been possible without her invaluable help and support.

🌟 What's Next

See ROADMAP.md for planned features:

  • Grapheme cluster support (v0.2.0+)
  • Extended Unicode compliance
  • Performance optimizations

Made with ❤️ by the Phoenix TUI Framework team | Powered by Go 1.25+

Full Changelog: v0.1.0-beta...v0.1.0

v0.1.0-beta - First Public Beta

18 Oct 20:14

Choose a tag to compare

Pre-release

🚀 uniwidth v0.1.0-beta - First Public Beta

High-performance Unicode width calculation library for Go 1.25+.

✨ Features

  • 3.9-46x faster than go-runewidth (proven in benchmarks)
  • Zero allocations - no GC pressure
  • Unicode 16.0 support with tiered lookup optimization
  • 87.1% test coverage with fuzzing and conformance tests
  • Cross-platform CI (Linux/macOS/Windows) - all passing ✅

📦 Installation

go get github.com/unilibs/uniwidth@v0.1.0-beta

🎯 Use Cases

Perfect for TUI frameworks, terminal emulators, CLI tools, and text editors.

⚠️ Beta Notice

This is a beta release for gathering community feedback. API may change before v1.0.0.

Known Limitations:
- Grapheme clusters not yet supported (planned for v0.2.0+)
- Some edge cases at Unicode boundaries (documented in CHANGELOG)

💬 Feedback Welcome

Please report issues and suggestions at https://github.com/unilibs/uniwidth/issues

Built by the https://github.com/phoenix-tui/phoenix team.

---
Full changelog: https://github.com/unilibs/uniwidth/blob/main/CHANGELOG.md