we currently use `String.length` to see how many columns we have moved. e.g. https://github.com/typelevel/paiges/blob/master/core/src/main/scala/org/typelevel/paiges/Chunk.scala#L108 https://github.com/typelevel/paiges/blob/master/core/src/main/scala/org/typelevel/paiges/Doc.scala#L299 https://github.com/typelevel/paiges/blob/master/core/src/main/scala/org/typelevel/paiges/Doc.scala#L579 But, for characters that don't fit in 16 bits, this will be incorrect. A possibly better, but more expensive, solution is to use: https://docs.oracle.com/javase/7/docs/api/java/lang/String.html#codePointCount(int,%20int) But there is also the question of halfwidth/fullwidth forms: https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms So, to be really pro-style, we need a way to take a `String` and return the width on the screen when it is printed.
we currently use
String.lengthto see how many columns we have moved. e.g.https://github.com/typelevel/paiges/blob/master/core/src/main/scala/org/typelevel/paiges/Chunk.scala#L108
https://github.com/typelevel/paiges/blob/master/core/src/main/scala/org/typelevel/paiges/Doc.scala#L299
https://github.com/typelevel/paiges/blob/master/core/src/main/scala/org/typelevel/paiges/Doc.scala#L579
But, for characters that don't fit in 16 bits, this will be incorrect. A possibly better, but more expensive, solution is to use: https://docs.oracle.com/javase/7/docs/api/java/lang/String.html#codePointCount(int,%20int)
But there is also the question of halfwidth/fullwidth forms:
https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms
So, to be really pro-style, we need a way to take a
Stringand return the width on the screen when it is printed.