Re: [Mutt] #2952: <BackSpace> should use terminal settings
#2952: <BackSpace> should use terminal settings
Comment (by Kyle Wheeler):
{{{
On Tuesday, September 11 at 07:37 AM, quoth Mutt:
> Conversely, you can't be sure that what the user (or something else)
> has configured for erase is really the backspace key.
Fair enough, but I don't expect mutt to handle pathological users.
I'm suggesting we go with "least surprise". The "erase" character,
whatever it is and no matter what key emits it, is the character that
triggers "backspace-like" behavior. So when I say "mutt, when I hit
backspace, do X", I expect mutt to understand backspace the same way
that every other program does: whatever key I hit that happens to
produce backspace behavior is the one I'm referring to. If I happen to
have configured my terminal such that the 'r' character is the "erase"
character (such that if I type "bar" I end up with just "b"), then
every program I run in that terminal is essentially treating 'r' as my
backspace key. Thus when I tell mutt to bind "backspace" to something,
I expect mutt to bind 'r' to that something. It's simply consistent.
And if I've done everything in my power short of writing my own
terminfo entry to convince my terminal that ^? is the backspace
character, then why must mutt be the only program still stubbornly
insisting that ^H is backspace? Vim doesn't use $TERM to override the
stty setting. Nor does emacs, nor does libreadline, nor does telnet,
xchat, bitchx, or any other terminal-based application. *WHY* is this
considered "good" behavior for mutt?
When I say "mutt, backspace means foo", what I'm really saying is
"Mutt, when I press the key that behaves as a backspace...". Of course
mutt can't make sure that they key I press is really *labelled*
"Backspace". On many Apple keyboards, it's actually labelled "Delete"
even though for all other intents and purposes it's the backspace key.
That's because the <BackSpace> key is a reference to "the key that has
the backspace effect". Of *course* mutt can't be prescient and somehow
find out whether or not my keyboard even *has* a BackSpace key, nor
can it find out for certain what that key actually emits. But it CAN
trust that when the user says "backspace" they don't think mutt is
omniscient. Simply using whatever happens to have the backspace effect
(namely, the "erase" character) makes perfect sense, and is consistent
with virtually every other terminal-based program. More to the point,
I really don't see how using anything else makes any sense at all.
Currently mutt is extracting this bit of information from the terminfo
entry. My point is that this is insufficient because the terminfo may
be wrong (buggy) or outdated (superseded). If this was our only
recourse, I'd say that's fine, but it's not the only recourse. There's
a better way to do it! Mutt can't find out if the terminfo entry is
wrong or buggy, but it CAN find out if the terminfo entry has been
superseded, and I think it *should*.
~Kyle
}}}
--
Ticket URL: <http://dev.mutt.org/trac/ticket/2952#comment:>