[dev] [st] Erasing UTF-8 characters in ed

From: Alexandre Niveau <alexandre.niveau_AT_gmail.com>
Date: Thu, 24 Jul 2014 00:44:47 +0200


I've been using st for a while now; it works great. Thanks to the devs
and maintainers!

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
summary http://git.suckless.org/st/commit/config.def.h?id=c46d929fe18e4a3c9c41101eafa7a9668c8c8830
— 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…

-- A.N.
Received on Thu Jul 24 2014 - 00:44:47 CEST

This archive was generated by hypermail 2.3.0 : Thu Jul 24 2014 - 00:48:07 CEST