parse_kbinput()
- Properly handle combined meta and escape sequences, so that
e.g. Meta-+ will work properly when the + is on the numeric
- keypad and NumLock is off. (DLR)
+ keypad and NumLock is off. Also, properly handle combined
+ control character and escape sequences, so that e.g. Esc Esc /
+ will work properly when the / is on the numeric keypad and
+ NumLock is off. (DLR)
- Translate extended keypad keys to their ASCII equivalents even
when we hit Escape once or twice before typing them, for
consistency. (DLR)
/* One escape: wait for more input. */
case 2:
/* Two escapes: wait for more input. */
+ case 3:
+ /* Three escapes: wait for more input. */
break;
default:
- /* More than two escapes: reset the escape counter
- * and wait for more input. */
- escapes = 0;
+ /* More than three escapes: limit the escape counter
+ * to no more than two, and wait for more input. */
+ escapes %= 3;
}
break;
default:
*kbinput);
}
break;
+ case 3:
+ /* Reset the escape counter. */
+ escapes = 0;
+ if (get_key_buffer_len() == 0)
+ /* Three escapes followed by a non-escape, and
+ * there aren't any other keystrokes waiting:
+ * normal input mode. Save the non-escape
+ * character as the result. */
+ retval = *kbinput;
+ else
+ /* Three escapes followed by a non-escape, and
+ * there are other keystrokes waiting: combined
+ * control character and escape sequence mode.
+ * Interpret the escape sequence, and interpret
+ * the result as a control sequence. */
+ retval = get_control_kbinput(
+ parse_escape_seq_kbinput(win,
+ *kbinput));
}
}