vty-6.4: A simple terminal UI library

Safe Haskell | None
Language | Haskell2010

Graphics.Text.Width

Description

This module provides functions to measure the terminal column width of characters and strings.

The functions provided in this module all ultimately make calls to the C implementation in `cbits/mk_wcwidth.c`. That code manages some global state that carries a table of Unicode character widths. For more details, see `Install`, the C code, and the "Multi-Column Character Support" section of the project `README`.

Synopsis

- wcwidth :: Char -> Int
- wcswidth :: String -> Int
- wctwidth :: Text -> Int
- wctlwidth :: Text -> Int
- safeWcwidth :: Char -> Int
- safeWcswidth :: String -> Int
- safeWctwidth :: Text -> Int
- safeWctlwidth :: Text -> Int

# Documentation

wcwidth :: Char -> Int Source #

wcswidth :: String -> Int Source #

wctwidth :: Text -> Int Source #

wctlwidth :: Text -> Int Source #

safeWcwidth :: Char -> Int Source #

Returns the display width of a character. Assumes all characters with unknown widths are 0 width.

safeWcswidth :: String -> Int Source #

Returns the display width of a string. Assumes all characters with unknown widths are 0 width.

safeWctwidth :: Text -> Int Source #

Returns the display width of a text. Assumes all characters with unknown widths are 0 width.

safeWctlwidth :: Text -> Int Source #

Returns the display width of a lazy text. Assumes all characters with unknown widths are 0 width.