This change introduces a new module,
Graphics.Vty.UnicodeWidthTable.Install, that is responsible for
installing custom unicode width tables into the process. It does so by
allocating memory to hold the table, populating the table's character
ranges with widths from the UnicodeWidthTable, and then marking the
table as ready for use. That causes future calls to 'wcwidth' to consult
the new table rather than relying on the built-in logic to compute
widths.
Note that this functionality breaks the purity of 'wcwidth': 'wcwidth'
calls made before the installation of a custom table may return
different values after the table is installed, despite 'wcwidth' being a
pure function. This choice was made deliberately to simplify the API and
is based on the observation that in practice this will probably never be
an issue.
It's also worth nothing (as is spelled out in the docs, too) that a
custom table installation can only be performed at most once per program
lifetime. Once a custom table installation is performed, it cannot be
undone and no new table can be installed. This, too, is a simplification
based on the assumption that in practice multiple tables will usually
not be required.
This commit adds getTtyEraseChar. This function queries the kernel
for the current terminal's settings to obtain the character assigned
by the "stty erase" command. The "erase" character indicates which
input character the terminal should interpret to mean "backspace" when
the terminal is in canonical input mode. Vty applications run with
canonical mode disabled, but even in those cases some users may want
their "stty erase" setting honored by Vty's input-handling so that
incoming erase characters (according to stty) result in "KBS" key events
being delivered to the application.
This change removes -~ and +~ definitions that can conflict with those
provided by Microlens, and which were just copies of what Microlens now
provides. Instead of using those, this change just inlines their
functionality in the right spots so that we don't have to conditionally
define or import those operators depending on the version of Microlens,
which just recently started to provide these.
This change also goes ahead and introduces an upper bound on Microlens
to avoid future issues like this.