package wcwidth

All checked builds pass
  1. Overview
  2. Docs
Get terminal display width of a string

Install

dune-project
 Dependency

Authors

Maintainers

Sources

v1.1.0.tar.gz
md5=1efe8d35df972a05b9c041c2918c7c60
sha512=f3ebb5977894d2659bf6c13c8d6b744bdab79d425dde1b85aeac999776d3e705f3a2f9e36f6f3c2c12190a4b4466059029dd22edaab3c3f38bc2853bc038a8e3

Description

Get terminal display width of a string

Added to opam-repository:

README

wcwidth

Implementation of the wcwidth(3) and wcswidth(3) functions for OCaml, which lets you calculate the number of columns a string occupies in a terminal.

Usage

Add wcwidth to your project dependencies.

# Wcwidth.wcswidth "hello";;
- : int = 5
# Wcwidth.wcswidth "🦆";;
- : int = 2

Update the character lists

The Unicode version the library uses is documented in wcwidth/char_list.ml.

This file also contains lists of zero-width and wide characters, and is derived from the Python wcwidth package. This file can be updated (e.g. to use a new Unicode version) using the Python script setup_char_lists.py:

python -m venv .venv
source .venv/bin/activate
python -m pip install wcwidth
python setup_char_lists.py

Dependencies (2)

  1. ocaml >= "4.14"
  2. dune >= "3.3"

Dev Dependencies (2)

  1. odoc with-doc
  2. alcotest with-test

Used by

None

Conflicts

None

Build status

Results of building wcwidth with each compiler on check.ci.ocaml.org, run of against opam-repository 7cdc698. All results for this package.

Each result links to its build log. To keep crawlers from overloading the site, build logs require a GitHub sign-in (see ocurrent/opam-health-check). On your first log, GitHub asks you to “Authorize opam-health-check”, the OCurrent app that runs these checks; it sees only your public profile, not your repositories. The sign-in lasts 30 days.

Version OCaml 4.11 OCaml 4.14 OCaml 5.2 OCaml 5.4 OCaml 5.5
1.1.0 (this version) n/a good good good good
  • good Package successfully built
  • partial One of the dependencies failed to build
  • bad Package failed to build
  • n/a Package is not available in this environment
  • internal Internal failure