Eliminate "Unknown ESC sequence: ..." messages caused by applying modifiers (shift, alt and ctrl) to cursor keys. Holding down a modifier key adds parameters to the cursor key escape sequence. `ESC [ x` becomes `ESC [ 1 ; # x`, where `#` depends upon the modifier key. This patch causes ESCmap::is_equal() and ESCmap::has_prefix() to ignore parameters when matching incoming key sequences. The cursor keys now have identical behavior whether or not a modifier key is present. Index: src/LineInput.cc =================================================================== --- src/LineInput.cc (revision 501) +++ src/LineInput.cc (working copy) @@ -80,13 +80,15 @@ bool ESCmap::has_prefix(const char * seq, int seq_len) const { - if (seq_len >= len) return false; + int ss = 0; loop(s, seq_len) { - if (seq[s] != seqence[s]) return false; + if (!isdigit(seq[s]) && seq[s] != ';') { + if (seq[s] != seqence[ss++]) return false; + } } - return true; + return ss < len; } //----------------------------------------------------------------------------- void @@ -100,13 +102,15 @@ bool ESCmap::is_equal(const char * seq, int seq_len) const { - if (len != seq_len) return false; + int ss = 0; loop(s, seq_len) { - if (seq[s] != seqence[s]) return false; + if (!isdigit(seq[s]) && seq[s] != ';') { + if (seq[s] != seqence[ss++]) return false; + } } - return true; + return ss == len; } //============================================================================= LineHistory::LineHistory(int maxl)