guide: some clarifying edits for text width issues

This commit is contained in:
Jonathan Daugherty 2022-08-05 15:26:28 -07:00
parent 32c1aa4f2f
commit 2473b32208

View File

@ -989,17 +989,18 @@ to support wide characters in your application, this will not work:
let width = Data.Text.length t
because if the string contains any wide characters, their widths
will not be counted properly. In order to get this right, use the
``TextWidth`` type class to compute the width:
If the string contains any wide characters, their widths will not be
counted properly. In order to get this right, use the ``TextWidth`` type
class to compute the width:
.. code:: haskell
let width = Brick.Widgets.Core.textWidth t
The ``TextWidth`` type class uses Vty's character width routine
to compute the correct width. If you need to compute
the width of a single character, use ``Graphics.Text.wcwidth``.
The ``TextWidth`` type class uses Vty's character width routine to
compute the width by looking up the string's characdters in a Unicode
width table. If you need to compute the width of a single character, use
``Graphics.Text.wcwidth``.
Extents
=======