File: BuildWidthTable.hs

package info (click to toggle)
haskell-vty-unix 0.2.0.0-2
  • links: PTS
  • area: main
  • in suites: sid, trixie
  • size: 204 kB
  • sloc: haskell: 1,748; ansic: 30; makefile: 5
file content (18 lines) | stat: -rw-r--r-- 384 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE CPP #-}
module Main where

import System.Console.ANSI (getCursorPosition)
import Text.Printf (printf)

import Graphics.Vty.UnicodeWidthTable.Main (defaultMain)

charWidth :: Char -> IO Int
charWidth c = do
    printf "\r"
    putChar c
    Just (_, col) <- getCursorPosition
    return col

main :: IO ()
main = defaultMain charWidth