alan-turing-institute / whatwhat

A reimagining of nowwhat in OCaml
MIT License
0 stars 0 forks source link

Figure out how to get string display width #88

Closed yongrenjie closed 1 year ago

yongrenjie commented 1 year ago

Inside the pretty.ml module we're using String.length a lot, when we should really be using the display width of the string.

e.g.

# String.length "😄";;
- : int = 4

when it should only really be 2.

yongrenjie commented 1 year ago

This is the equivalent in Haskell: https://hackage.haskell.org/package/vty-5.38/docs/Graphics-Text-Width.html (https://github.com/jtdaugherty/vty)

It's a wrapper around a C library. Now, how do we do that in Ocaml...