szermatt / mistty

Shell/Comint alternative with a fully functional terminal for Emacs 29.1 and later.
GNU General Public License v3.0
92 stars 5 forks source link

Unix `read` does not respect backspace under mistty (macos) #12

Open candera opened 11 months ago

candera commented 11 months ago

Use of read under mistty does not correctly handle backspace:

{master !2 ?2}
~/projects/emacs candera@brightmoon $ read -p "Yes? "
Yes? No, no^?^?^?no
{master !2 ?2}
~/projects/emacs candera@brightmoon $ echo $REPLY
No, nono
{master !2 ?2}
~/projects/emacs candera@brightmoon $ 

Untitled 2

szermatt commented 11 months ago

This happens under macos, but not Linux.

/usr/bin/read, bash and zsh read don't handle \x7f (nor ^H). Yet, this works under macos Terminal app or iTerm, which both send \x7f by default. This also doesn't work in Emacs ansi-term, so it's an issue inherited from term.el. Fish read always works.

I haven't been able to figure out what's happening yet.

As a workaround, under bash, read -e works.

candera commented 11 months ago

Ah, OK, -e works for the case I need.

Thanks again!