From another piece of command-line driven software, I'm used to the following behavior: Arrow up / down go through the command history, matching lines that match the characters typed so far on the current line, and Esc deletes everything typed so far on the current line. I'm trying to make bash (via readline) do the same. Here's what I put into my .bashrc:
bind 'Escape: kill-whole-line' bind '"\e[A": history-search-backward' bind '"\e[B": history-search-forward'
The behavior is not as intended, due to the interference of the mapping of Escape="\e" with the mapping of the escape sequences "\e[A" and "\e[B".
My question: Is there a way to make this work? One possibility would be timing-based, i.e. if \e is followed quickly by another key it is treated as part of a sequence, but if nothing else is coming during some short delay it is treated as a key by itself. However, reading the bash and readline documentation I was not able to come up with such a thing.
Side question: Is there a modern terminal "emulator" which does not actually try to emulate the convoluted behavior of historical machines, but provides programs running in it with unambiguous information about the keys pressed? Which would also enable things like distinguishing between CTRL-A and CTRL-SHIFT-A... I tested these things in KDE's Konsole, which behaves like an xterm, and on the Linux console.