[st] Erasing UTF-8 characters in ed
Alexandre Niveau <alexandre.niveau <at> gmail.com>
2014-07-23 22:44:47 GMT
I've been using st for a while now; it works great. Thanks to the devs
I have a problem though, when using ed; I don't know whether it's a
bug in st or elsewhere. When typing a line in ed, using backspace to
erase a multibyte UTF-8 character *seems* OK visually, but does not
work: only the last byte is really removed, leaving an invalid UTF-8
character. For example, 3-byte characters need 3 backspaces to be
erased, but the terminal shows 3 characters erased.
Steps to reproduce (^H is a backspace):
$ ed test
The resulting file contains bytes 61 c3 61 0a.
I tried GNU ed, ed from 9base, and sam -d, launched from bash and
9base's rc. They all have this behaviour in st, both in version 0.5
and tip (using stty erase ^H for tip, as explained in this commit
— as a side note, wouldn't this be worth mentioning in the FAQ?).
However in xterm, gnome-terminal, and lxterminal, both ed and sam -d
work as expected.
It may be that one's not supposed to use backspaces in ed, but this
behaviour is weird nonetheless…