Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
The old backspace/delete problem
- X-seq: zsh-users 8397
- From: Boyd Adamson <boyd-adamson@xxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: The old backspace/delete problem
- Date: Thu, 20 Jan 2005 00:12:32 +1100
- Cancel-lock: sha1:qD7d1uoT9dXzUf2yg7PgFs+GuIM=
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- Sender: news <news@xxxxxxxxxxxxx>
Someone recently mentioned to me a solution to the old "backspace key
sends ^? or ^H" problem that I hadn't heard of, and I thought we here
in zsh land might be able to improve on it.
The solution I saw was for a ksh user:
alias ^?='stty erase ^?'
alias ^H='stty erase ^H'
The idea is that on login, the user types <backspace><enter>. This
will do one of two things:
1. The character sent by the backspace key will match the current tty
setting. In this case nothing happens except for a new prompt, or,
2. The character sent by the backspace key does not match the current
tty setting, the alias is expanded and the tty setting is changed
to match the terminal emulator.
Now this is nice, but it doesn't help those of use who use a superior
shell, since both ^? and ^H are normally mapped to the same function
(something like backward-delete-char). This is nice in the shell, but
potentially leaves us with a broken backspace key in other command
line programs.
Any ideas on how we could do this sort of auto-detection in zsh? What
about the ability to automatically do the stty stuff the first time we
receive a ^H or ^?, even in the middle of the command? Something like
this:
$ cd /usr/liv<backspace>
causes stty erase <whatever> to be run in the background and then
backward-delete-char - and after that fall back to the normal
behavior.
Any thoughts? Is this just crazy? Or has it been done before?
Boyd
Messages sorted by:
Reverse Date,
Date,
Thread,
Author