Commit d48071b2 authored by David Lawrence Ramsey's avatar David Lawrence Ramsey Committed by Benno Schulenberg
Browse files

input: properly check the full escape sequences for all keys

Also for Delete, End, PageUp and PageDown (on some terminals)
the last byte in the sequence needs to be checked.

This fixes https://savannah.gnu.org/bugs/?49710.
No related merge requests found
Showing with 12 additions and 4 deletions
+12 -4
...@@ -1015,18 +1015,26 @@ int convert_sequence(const int *seq, size_t seq_len) ...@@ -1015,18 +1015,26 @@ int convert_sequence(const int *seq, size_t seq_len)
break; break;
case '3': /* Esc [ 3 ~ == Delete on VT220/VT320/ case '3': /* Esc [ 3 ~ == Delete on VT220/VT320/
* Linux console/xterm/Terminal. */ * Linux console/xterm/Terminal. */
return KEY_DC; if (seq_len > 2 && seq[2] == '~')
return KEY_DC;
break;
case '4': /* Esc [ 4 ~ == End on VT220/VT320/Linux case '4': /* Esc [ 4 ~ == End on VT220/VT320/Linux
* console/xterm. */ * console/xterm. */
return KEY_END; if (seq_len > 2 && seq[2] == '~')
return KEY_END;
break;
case '5': /* Esc [ 5 ~ == PageUp on VT220/VT320/ case '5': /* Esc [ 5 ~ == PageUp on VT220/VT320/
* Linux console/xterm/Terminal; * Linux console/xterm/Terminal;
* Esc [ 5 ^ == PageUp on Eterm. */ * Esc [ 5 ^ == PageUp on Eterm. */
return KEY_PPAGE; if (seq_len > 2 && (seq[2] == '~' || seq[2] == '^'))
return KEY_PPAGE;
break;
case '6': /* Esc [ 6 ~ == PageDown on VT220/VT320/ case '6': /* Esc [ 6 ~ == PageDown on VT220/VT320/
* Linux console/xterm/Terminal; * Linux console/xterm/Terminal;
* Esc [ 6 ^ == PageDown on Eterm. */ * Esc [ 6 ^ == PageDown on Eterm. */
return KEY_NPAGE; if (seq_len > 2 && (seq[2] == '~' || seq[2] == '^'))
return KEY_NPAGE;
break;
case '7': /* Esc [ 7 ~ == Home on Eterm/rxvt, case '7': /* Esc [ 7 ~ == Home on Eterm/rxvt,
* Esc [ 7 $ == Shift-Home on Eterm/rxvt. */ * Esc [ 7 $ == Shift-Home on Eterm/rxvt. */
if (seq_len > 2 && seq[2] == '~') if (seq_len > 2 && seq[2] == '~')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment