summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2023-02-14 21:50:21 +0100
committerSébastien Helleu <flashcode@flashtux.org>2023-03-16 20:42:18 +0100
commit21910b70509685c678e5ac3ff0249382a3b2c494 (patch)
tree3a1de9c442199677c7c6baf9a428cb5991f47ca4
parent0781f297268b8951938c43f564799609bc9a2d51 (diff)
downloadweechat-21910b70509685c678e5ac3ff0249382a3b2c494.zip
core: add function to expand raw key code to name with alias, use it in /key debug
-rw-r--r--src/core/wee-command.c2
-rw-r--r--src/core/wee-completion.c6
-rw-r--r--src/core/wee-config.c2
-rw-r--r--src/gui/gui-key.c646
-rw-r--r--src/gui/gui-key.h5
-rw-r--r--tests/unit/gui/test-gui-key.cpp752
6 files changed, 1289 insertions, 124 deletions
diff --git a/src/core/wee-command.c b/src/core/wee-command.c
index 7a6b491ee..259e53ac7 100644
--- a/src/core/wee-command.c
+++ b/src/core/wee-command.c
@@ -3761,7 +3761,7 @@ command_key_display (struct t_gui_key *key, struct t_gui_key *default_key)
{
char *expanded_name;
- expanded_name = gui_key_get_expanded_name (key->key);
+ expanded_name = gui_key_expand_legacy (key->key);
if (default_key)
{
diff --git a/src/core/wee-completion.c b/src/core/wee-completion.c
index 0e307c203..85274f8e6 100644
--- a/src/core/wee-completion.c
+++ b/src/core/wee-completion.c
@@ -1689,7 +1689,7 @@ completion_list_add_keys_codes_cb (const void *pointer, void *data,
{
for (ptr_key = gui_keys[i]; ptr_key; ptr_key = ptr_key->next_key)
{
- expanded_name = gui_key_get_expanded_name (ptr_key->key);
+ expanded_name = gui_key_expand_legacy (ptr_key->key);
gui_completion_list_add (
completion,
(expanded_name) ? expanded_name : ptr_key->key,
@@ -1732,7 +1732,7 @@ completion_list_add_keys_codes_for_reset_cb (const void *pointer, void *data,
if (!ptr_default_key
|| (strcmp (ptr_default_key->command, ptr_key->command) != 0))
{
- expanded_name = gui_key_get_expanded_name (ptr_key->key);
+ expanded_name = gui_key_expand_legacy (ptr_key->key);
gui_completion_list_add (
completion,
(expanded_name) ? expanded_name : ptr_key->key,
@@ -1749,7 +1749,7 @@ completion_list_add_keys_codes_for_reset_cb (const void *pointer, void *data,
ptr_key = gui_key_search (gui_keys[i], ptr_default_key->key);
if (!ptr_key)
{
- expanded_name = gui_key_get_expanded_name (ptr_default_key->key);
+ expanded_name = gui_key_expand_legacy (ptr_default_key->key);
gui_completion_list_add (
completion,
(expanded_name) ? expanded_name : ptr_default_key->key,
diff --git a/src/core/wee-config.c b/src/core/wee-config.c
index 72d9ec72c..a0a34c196 100644
--- a/src/core/wee-config.c
+++ b/src/core/wee-config.c
@@ -2602,7 +2602,7 @@ config_weechat_key_write_cb (const void *pointer, void *data,
}
for (ptr_key = gui_keys[context]; ptr_key; ptr_key = ptr_key->next_key)
{
- expanded_name = gui_key_get_expanded_name (ptr_key->key);
+ expanded_name = gui_key_expand_legacy (ptr_key->key);
if (expanded_name)
{
rc = config_file_write_line (config_file,
diff --git a/src/gui/gui-key.c b/src/gui/gui-key.c
index c08459a95..cdd9f4ee5 100644
--- a/src/gui/gui-key.c
+++ b/src/gui/gui-key.c
@@ -214,7 +214,7 @@ gui_key_grab_end_timer_cb (const void *pointer, void *data,
(void) remaining_calls;
/* get expanded name (for example: \x01+U => ctrl-u) */
- expanded_key = gui_key_get_expanded_name (gui_key_combo_buffer);
+ expanded_key = gui_key_expand_legacy (gui_key_combo_buffer);
if (expanded_key)
{
/*
@@ -272,10 +272,11 @@ gui_key_grab_end_timer_cb (const void *pointer, void *data,
* Gets internal code from user key name.
*
* Examples:
- * "meta-a" => "\x01[a"
- * "meta-A" => "\x01[A"
* "ctrl-R" => "\x01" + "r" (lower case enforced for ctrl keys)
* "ctrl-r" => "\x01" + "r"
+ * "meta-a" => "\x01[a"
+ * "meta-A" => "\x01[A"
+ * "meta-wmeta2-1;3A" => "\x01" + "[w" + "\x01" + "[[1;3A"
*
* Note: result must be freed after use.
*/
@@ -346,15 +347,22 @@ gui_key_get_internal_code (const char *key)
}
/*
- * Gets expanded name from internal key code.
+ * Gets expanded name from internal key code (legacy function).
*
- * For example: return "ctrl-r" for "\x01+r".
+ * Examples:
+ * "\001j" => "ctrl-j"
+ * "\001m" => "ctrl-m"
+ * "\001r" => "ctrl-r"
+ * "\001[A" => "meta-A"
+ * "\001[a" => "meta-a"
+ * "\001[[1;3D" => "meta2-1;3D"
+ * "\001[w\001[[1;3A" => "meta-wmeta2-1;3A"
*
* Note: result must be freed after use.
*/
char *
-gui_key_get_expanded_name (const char *key)
+gui_key_expand_legacy (const char *key)
{
char **result;
@@ -398,6 +406,503 @@ gui_key_get_expanded_name (const char *key)
}
/*
+ * Expands raw key code to its name and name using aliases (human readable
+ * key name).
+ *
+ * Examples (return: rc, key name, key name with alias):
+ * "\001" => 0, NULL, NULL
+ * "\001j" => 1, "ctrl-j", "return"
+ * "\001m" => 1, "ctrl-m", "return"
+ * "\001r" => 1, "ctrl-r", "ctrl-r"
+ * "\001[A" => 1, "meta-A", "meta-A"
+ * "\001[a" => 1, "meta-a", "meta-a"
+ * "\001[[1;3D" => 1, "meta2-1;3D", "meta-left"
+ * "\001[w\001[[1;3A" => 1, "meta-w,meta2-1;3A", "meta-w,meta-up"
+ *
+ * Returns:
+ * 1: OK
+ * 0: error: incomplete/invalid raw key
+ *
+ * Note: if set to non NULL value, *key_name_raw and *key_name_alias must be
+ * freed.
+ */
+
+int
+gui_key_expand (const char *key, char **key_name, char **key_name_alias)
+{
+ const char *ptr_key_meta2;
+ char **str_dyn_key, **str_dyn_key_alias, str_raw[64], str_alias[128];
+ int i, modifier, ctrl, meta, meta_initial, meta2, shift, number, length;
+
+ if (key_name)
+ *key_name = NULL;
+ if (key_name_alias)
+ *key_name_alias = NULL;
+
+ if (!key)
+ return 0;
+
+ str_dyn_key = NULL;
+ str_dyn_key_alias = NULL;
+
+ str_dyn_key = string_dyn_alloc ((strlen (key) * 2) + 1);
+ if (!str_dyn_key)
+ goto error;
+
+ str_dyn_key_alias = string_dyn_alloc ((strlen (key) * 2) + 1);
+ if (!str_dyn_key_alias)
+ goto error;
+
+ while (key[0])
+ {
+ ctrl = 0;
+ meta = 0;
+ meta_initial = 0;
+ meta2 = 0;
+ shift = 0;
+
+ if (*str_dyn_key[0])
+ string_dyn_concat (str_dyn_key, ",", -1);
+
+ if (*str_dyn_key_alias[0])
+ string_dyn_concat (str_dyn_key_alias, ",", -1);
+
+ while (string_strncmp (key, "\x01[\x01", 3) == 0)
+ {
+ /* key: meta + meta-something: increase meta and skip it */
+ meta++;
+ key += 2;
+ }
+
+ if (string_strncmp (key, "\x01[[O", 4) == 0)
+ {
+ meta2 = 1;
+ key += 4;
+ }
+ else if (string_strncmp (key, "\x01[O", 3) == 0)
+ {
+ meta2 = 1;
+ key += 3;
+ }
+ else if (string_strncmp (key, "\x01[[", 3) == 0)
+ {
+ meta2 = 1;
+ key += 3;
+ }
+ else if (string_strncmp (key, "\x01[", 2) == 0)
+ {
+ meta++;
+ key += 2;
+ }
+ else if (key[0] == '\x01')
+ {
+ ctrl = 1;
+ key++;
+ }
+
+ if (!key[0])
+ goto error;
+
+ if (meta2)
+ {
+ ptr_key_meta2 = key;
+ meta_initial = meta;
+ str_alias[0] = '\0';
+
+ if (isdigit ((unsigned char)key[0])
+ && (!key[1]
+ || (isdigit ((unsigned char)key[1])
+ && (!key[2]
+ || (isdigit ((unsigned char)key[2]) && !key[3])))))
+ {
+ /* incomplete sequence: 1 to 3 digits with nothing after */
+ goto error;
+ }
+
+ /*
+ * Supported formats: "<esc>[" + one of:
+ * 3~ -> delete
+ * 3;5~ -> ctrl-delete
+ * 15~ -> f5
+ * 15;5~ -> ctrl-f5
+ * A -> up
+ * 1;5A -> ctrl-up
+ */
+ if ((key[0] == '1') && (key[1] == ';')
+ && ((key[2] >= '1') && (key[2] <= '9')))
+ {
+ /* modifier, format: "1;1" to "1;9" */
+ modifier = key[2] - '0' - 1;
+ if ((modifier & 0x01) || (modifier & 0x08))
+ shift = 1;
+ if ((modifier & 0x02) || (modifier & 0x08))
+ meta++;
+ if ((modifier & 0x04) || (modifier & 0x08))
+ ctrl = 1;
+ key += 3;
+ }
+
+ if (!key[0])
+ goto error;
+
+ if (isdigit ((unsigned char)key[0])
+ && isdigit ((unsigned char)key[1])
+ && ((key[2] == ';') || (key[2] == '~') || (key[2] == '^')
+ || (key[2] == '$') || (key[2] == '@')))
+ {
+ /*
+ * format: "00;N~" to "99;N~" (urxvt: ~ ^ $ @)
+ * or "00~" to "99~" (urxvt: ~ ^ $ @)
+ */
+ number = ((key[0] - '0') * 10) + (key[1] - '0');
+ if ((number >= 10) && (number <= 15))
+ snprintf (str_alias, sizeof (str_alias), "f%d", number - 10);
+ else if ((number >= 17) && (number <= 21))
+ snprintf (str_alias, sizeof (str_alias), "f%d", number - 11);
+ else if ((number >= 23) && (number <= 26))
+ snprintf (str_alias, sizeof (str_alias), "f%d", number - 12);
+ else if ((number >= 28) && (number <= 29))
+ snprintf (str_alias, sizeof (str_alias), "f%d", number - 13);
+ else if ((number >= 31) && (number <= 34))
+ snprintf (str_alias, sizeof (str_alias), "f%d", number - 14);
+ key += 2;
+ if (key[0] == ';')
+ {
+ key++;
+ if (!key[0])
+ goto error;
+ if ((key[0] >= '1') && (key[0] <= '9'))
+ {
+ modifier = key[0] - '0' - 1;
+ if ((modifier & 0x01) || (modifier & 0x08))
+ shift = 1;
+ if ((modifier & 0x02) || (modifier & 0x08))
+ meta++;
+ if ((modifier & 0x04) || (modifier & 0x08))
+ ctrl = 1;
+ key++;
+ if (!key[0])
+ goto error;
+ }
+ }
+ if (key[0] == '^')
+ ctrl = 1;
+ else if (key[0] == '$')
+ shift = 1;
+ else if (key[0] == '@')
+ {
+ ctrl = 1;
+ shift = 1;
+ }
+ key++;
+ }
+ else if (isdigit ((unsigned char)key[0])
+ && ((key[1] == ';') || (key[1] == '~') || (key[1] == '^')
+ || (key[1] == '$') || (key[1] == '@')))
+ {
+ /*
+ * format: "0;N~" to "9;N~" (urxvt: ~ ^ $ @)
+ * or "0~" to "9~" (urxvt: ~ ^ $ @)
+ * */
+ number = key[0] - '0';
+ if ((number == 1) || (number == 7))
+ snprintf (str_alias, sizeof (str_alias), "home");
+ else if (number == 2)
+ snprintf (str_alias, sizeof (str_alias), "insert");
+ else if (number == 3)
+ snprintf (str_alias, sizeof (str_alias), "delete");
+ else if ((number == 4) || (number == 8))
+ snprintf (str_alias, sizeof (str_alias), "end");
+ else if (number == 5)
+ snprintf (str_alias, sizeof (str_alias), "pgup");
+ else if (number == 6)
+ snprintf (str_alias, sizeof (str_alias), "pgdn");
+ key++;
+ if (key[0] == ';')
+ {
+ key++;
+ if (!key[0])
+ goto error;
+ if ((key[0] >= '1') && (key[0] <= '9'))
+ {
+ modifier = key[0] - '0' - 1;
+ if ((modifier & 0x01) || (modifier & 0x08))
+ shift = 1;
+ if ((modifier & 0x02) || (modifier & 0x08))
+ meta++;
+ if ((modifier & 0x04) || (modifier & 0x08))
+ ctrl = 1;
+ key++;
+ if (!key[0])
+ goto error;
+
+ }
+ }
+ if (key[0] == '^')
+ ctrl = 1;
+ else if (key[0] == '$')
+ shift = 1;
+ else if (key[0] == '@')
+ {
+ ctrl = 1;
+ shift = 1;
+ }
+ key++;
+ }
+ else if (((key[0] >= 'A') && (key[0] <= 'Z'))
+ || ((key[0] >= 'a') && (key[0] <= 'z')))
+ {
+ /* format: "A" to "Z" */
+ if (key[0] == 'A')
+ snprintf (str_alias, sizeof (str_alias), "up");
+ else if (key[0] == 'a')
+ {
+ ctrl = 1;
+ snprintf (str_alias, sizeof (str_alias), "up");
+ }
+ else if (key[0] == 'B')
+ snprintf (str_alias, sizeof (str_alias), "down");
+ else if (key[0] == 'b')
+ {
+ ctrl = 1;
+ snprintf (str_alias, sizeof (str_alias), "down");
+ }
+ else if (key[0] == 'C')
+ snprintf (str_alias, sizeof (str_alias), "right");
+ else if (key[0] == 'c')
+ {
+ ctrl = 1;
+ snprintf (str_alias, sizeof (str_alias), "right");
+ }
+ else if (key[0] == 'D')
+ snprintf (str_alias, sizeof (str_alias), "left");
+ else if (key[0] == 'd')
+ {
+ ctrl = 1;
+ snprintf (str_alias, sizeof (str_alias), "left");
+ }
+ else if (key[0] == 'F')
+ snprintf (str_alias, sizeof (str_alias), "end");
+ else if (key[0] == 'G')
+ snprintf (str_alias, sizeof (str_alias), "pgdn");
+ else if (key[0] == 'H')
+ snprintf (str_alias, sizeof (str_alias), "home");
+ else if (key[0] == 'I')
+ snprintf (str_alias, sizeof (str_alias), "pgup");
+ else if (key[0] == 'P')
+ snprintf (str_alias, sizeof (str_alias), "f1");
+ else if (key[0] == 'Q')
+ snprintf (str_alias, sizeof (str_alias), "f2");
+ else if (key[0] == 'R')
+ snprintf (str_alias, sizeof (str_alias), "f3");
+ else if (key[0] == 'S')
+ snprintf (str_alias, sizeof (str_alias), "f4");
+ else if (key[0] == 'Z')
+ {
+ shift = 1;
+ snprintf (str_alias, sizeof (str_alias), "tab");
+ }
+ key++;
+ }
+ else if (key[0] == '[')
+ {
+ /* some sequences specific to Linux console */
+ key++;
+ if (!key[0])
+ goto error;
+ if (key[0] == 'A')
+ snprintf (str_alias, sizeof (str_alias), "f1");
+ else if (key[0] == 'B')
+ snprintf (str_alias, sizeof (str_alias), "f2");
+ else if (key[0] == 'C')
+ snprintf (str_alias, sizeof (str_alias), "f3");
+ else if (key[0] == 'D')
+ snprintf (str_alias, sizeof (str_alias), "f4");
+ else if (key[0] == 'E')
+ snprintf (str_alias, sizeof (str_alias), "f5");
+ key++;
+ }
+ else
+ {
+ /* unknown sequence */
+ key = utf8_next_char (key);
+ }
+
+ length = key - ptr_key_meta2;
+ snprintf (str_raw, sizeof (str_raw), "meta2-");
+ memcpy (str_raw + 6, ptr_key_meta2, length);
+ str_raw[6 + length] = '\0';
+
+ if (!str_alias[0])
+ {
+ /* unknown sequence: keep raw key code as-is */
+ snprintf (str_alias, sizeof (str_alias), "%s", str_raw);
+ ctrl = 0;
+ meta = 0;
+ shift = 0;
+ }
+
+ /* add modifier(s) + key (raw) */
+ if (str_raw[0])
+ {
+ for (i = 0; i < meta_initial; i++)
+ {
+ string_dyn_concat (str_dyn_key, "meta-", -1);
+ }
+ string_dyn_concat (str_dyn_key, str_raw, -1);
+ }
+
+ /* add modifier(s) + key (alias) */
+ if (str_alias[0])
+ {
+ for (i = 0; i < meta; i++)
+ {
+ string_dyn_concat (str_dyn_key_alias, "meta-", -1);
+ }
+ if (ctrl)
+ string_dyn_concat (str_dyn_key_alias, "ctrl-", -1);
+ if (shift)
+ string_dyn_concat (str_dyn_key_alias, "shift-", -1);
+ string_dyn_concat (str_dyn_key_alias, str_alias, -1);
+ }
+ }
+ else
+ {
+ /* automatically convert ctrl-[A-Z] to ctrl-[a-z] (lower case) */
+ if (ctrl && (key[0] >= 'A') && (key[0] <= 'Z'))
+ {
+ snprintf (str_raw, sizeof (str_raw),
+ "%c", key[0] + ('a' - 'A'));
+ key++;
+ }
+ else if (key[0] == ' ')
+ {
+ snprintf (str_raw, sizeof (str_raw), "space");
+ key++;
+ }
+ else if (key[0] == ',')
+ {
+ snprintf (str_raw, sizeof (str_raw), "comma");
+ key++;
+ }
+ else
+ {
+ length = utf8_char_size (key);
+ memcpy (str_raw, key, length);
+ str_raw[length] = '\0';
+ key += length;
+ }
+
+ if (meta)
+ {
+ for (i = 0; i < meta; i++)
+ {
+ string_dyn_concat (str_dyn_key, "meta-", -1);
+ string_dyn_concat (str_dyn_key_alias, "meta-", -1);
+ }
+ }
+
+ if (ctrl
+ && ((strcmp (str_raw, "h") == 0)
+ || strcmp (str_raw, "?") == 0))
+ {
+ string_dyn_concat (str_dyn_key, "ctrl-", -1);
+ string_dyn_concat (str_dyn_key, str_raw, -1);
+ string_dyn_concat (str_dyn_key_alias, "backspace", -1);
+ }
+ else if (ctrl && (strcmp (str_raw, "i") == 0))
+ {
+ string_dyn_concat (str_dyn_key, "ctrl-", -1);
+ string_dyn_concat (str_dyn_key, str_raw, -1);
+ string_dyn_concat (str_dyn_key_alias, "tab", -1);
+ }
+ else if (ctrl
+ && ((strcmp (str_raw, "j") == 0)
+ || (strcmp (str_raw, "m") == 0)))
+ {
+ string_dyn_concat (str_dyn_key, "ctrl-", -1);
+ string_dyn_concat (str_dyn_key, str_raw, -1);
+ string_dyn_concat (str_dyn_key_alias, "return", -1);
+ }
+ else
+ {
+ if (ctrl)
+ {
+ string_dyn_concat (str_dyn_key, "ctrl-", -1);
+ string_dyn_concat (str_dyn_key_alias, "ctrl-", -1);
+ }
+ string_dyn_concat (str_dyn_key, str_raw, -1);
+ string_dyn_concat (str_dyn_key_alias, str_raw, -1);
+ }
+ }
+ }
+
+ if (key_name)
+ *key_name = string_dyn_free (str_dyn_key, 0);
+ else
+ string_dyn_free (str_dyn_key, 1);
+
+ if (key_name_alias)
+ *key_name_alias = string_dyn_free (str_dyn_key_alias, 0);
+ else
+ string_dyn_free (str_dyn_key_alias, 1);
+
+ return 1;
+
+error:
+ if (str_dyn_key)
+ string_dyn_free (str_dyn_key, 1);
+ if (str_dyn_key_alias)
+ string_dyn_free (str_dyn_key_alias, 1);
+ return 0;
+}
+
+/*
+ * Converts a legacy key to the new key name (using comma separator and alias).
+ *
+ * Examples:
+ * "ctrl-" => NULL
+ * "meta-" => NULL
+ * "ctrl-A" => "ctrl-a"
+ * "ctrl-a" => "ctrl-a"
+ * "ctrl-j" => "return"
+ * "ctrl-m" => "ctrl-m"
+ * "ctrl-cb" => "ctrl-c,b"
+ * "meta-space" => "meta-space"
+ * "meta-comma" => "meta-c,o,m,m,a"
+ * "meta-," => "meta-comma"
+ * "meta-,x" => "meta-comma,x"
+ * "meta2-1;3D" => "meta-left"
+ * "meta-wmeta2-1;3A" => "meta-w,meta-up"
+ * "meta-w,meta-up" => "meta-w,comma,meta-u,p"
+ *
+ * Note: result must be freed after use.
+ */
+
+char *
+gui_key_legacy_to_alias (const char *key)
+{
+ char *key_raw, *key_name_alias;
+ int rc;
+
+ if (!key)
+ return NULL;
+
+ key_raw = gui_key_get_internal_code (key);
+ if (!key_raw)
+ return NULL;
+
+ rc = gui_key_expand (key_raw, NULL, &key_name_alias);
+
+ free (key_raw);
+
+ if (!rc)
+ return NULL;
+
+ return key_name_alias;
+}
+
+/*
* Searches for position of a key (to keep keys sorted).
*/
@@ -682,7 +1187,7 @@ gui_key_new (struct t_gui_buffer *buffer, int context, const char *key,
return NULL;
}
- expanded_name = gui_key_get_expanded_name (internal_code);
+ expanded_name = gui_key_expand_legacy (internal_code);
if (!expanded_name)
{
free (internal_code);
@@ -906,7 +1411,7 @@ gui_key_unbind (struct t_gui_buffer *buffer, int context, const char *key)
return 0;
}
- expanded_name = gui_key_get_expanded_name (internal_code);
+ expanded_name = gui_key_expand_legacy (internal_code);
if (!expanded_name)
{
free (internal_code);
@@ -1302,34 +1807,6 @@ end:
}
/*
- * Checks if the given combo of keys is complete or not.
- * It's not complete if the end of string is in the middle of a key
- * (for example meta- without the following char/key).
- *
- * Returns:
- * 0: key is incomplete (truncated)
- * 1: key is complete
- */
-
-int
-gui_key_is_complete (const char *key)
-{
- int length;
-
- if (!key || !key[0])
- return 1;
-
- length = strlen (key);
-
- if (((length >= 1) && (strcmp (key + length - 1, "\x01") == 0))
- || ((length >= 2) && (strcmp (key + length - 2, "\x01[") == 0))
- || ((length >= 3) && (strcmp (key + length - 3, "\x01[[") == 0)))
- return 0;
-
- return 1;
-}
-
-/*
* Processes a new key pressed.
*
* Returns:
@@ -1340,12 +1817,18 @@ gui_key_is_complete (const char *key)
int
gui_key_pressed (const char *key_str)
{
- int i, insert_into_input, context, length, length_key, rc, signal_sent;
+ int i, insert_into_input, context, length, length_key, signal_sent;
+ int rc, rc_expand;
struct t_gui_key *ptr_key;
- char *pos, signal_name[128], **commands, *expanded_key;
+ char *pos, signal_name[128], **commands;
+ char *key_name_legacy, *key_name, *key_name_alias;
signal_sent = 0;
+ key_name_legacy = NULL;
+ key_name = NULL;
+ key_name_alias = NULL;
+
/* add key to buffer */
insert_into_input = (gui_key_combo_buffer[0] == '\0');
length = strlen (gui_key_combo_buffer);
@@ -1360,7 +1843,7 @@ gui_key_pressed (const char *key_str)
gui_key_debug = 0;
gui_key_combo_buffer[0] = '\0';
gui_bar_item_update ("input_text");
- return 0;
+ goto end_no_input;
}
}
@@ -1373,7 +1856,7 @@ gui_key_pressed (const char *key_str)
&gui_key_grab_end_timer_cb, NULL, NULL);
}
gui_key_grab_count++;
- return 0;
+ goto end_no_input;
}
/* mouse event pending */
@@ -1394,7 +1877,7 @@ gui_key_pressed (const char *key_str)
gui_mouse_event_init ();
}
}
- return 0;
+ goto end_no_input;
}
if (strstr (gui_key_combo_buffer, "\x01[[M"))
@@ -1402,9 +1885,14 @@ gui_key_pressed (const char *key_str)
gui_key_combo_buffer[0] = '\0';
if (!gui_key_debug)
gui_mouse_event_init ();
- return 0;
+ goto end_no_input;
}
+ key_name_legacy = gui_key_expand_legacy (gui_key_combo_buffer);
+ rc_expand = gui_key_expand (gui_key_combo_buffer,
+ &key_name,
+ &key_name_alias);
+
ptr_key = NULL;
context = gui_key_get_current_context ();
@@ -1451,29 +1939,11 @@ gui_key_pressed (const char *key_str)
/* exact combo found => execute command */
if (gui_key_debug)
{
- expanded_key = gui_key_get_expanded_name (gui_key_combo_buffer);
gui_chat_printf (
NULL,
- _("debug: %s\"%s%s%s\"%s -> %s\"%s%s%s\"%s -> %s\"%s%s%s\""),
- /* raw code */
- GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS),
- GUI_COLOR(GUI_COLOR_CHAT),
- gui_key_combo_buffer,
- GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS),
- GUI_COLOR(GUI_COLOR_CHAT),
- /* expanded name */
- GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS),
- GUI_COLOR(GUI_COLOR_CHAT),
- expanded_key,
- GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS),
- GUI_COLOR(GUI_COLOR_CHAT),
- /* command */
- GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS),
- GUI_COLOR(GUI_COLOR_CHAT),
- ptr_key->command,
- GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS));
- if (expanded_key)
- free (expanded_key);
+ _("debug: \"%s\" -> %s (legacy: %s) -> %s -> \"%s\""),
+ gui_key_combo_buffer, key_name, key_name_legacy,
+ key_name_alias, ptr_key->command);
gui_key_combo_buffer[0] = '\0';
}
else
@@ -1499,7 +1969,7 @@ gui_key_pressed (const char *key_str)
}
}
}
- return 0;
+ goto end_no_input;
}
if (!gui_key_debug)
@@ -1514,12 +1984,12 @@ gui_key_pressed (const char *key_str)
gui_key_combo_buffer) == WEECHAT_RC_OK_EAT)
{
gui_key_combo_buffer[0] = '\0';
- return 0;
+ goto end_no_input;
}
if (gui_key_focus (gui_key_combo_buffer, GUI_KEY_CONTEXT_CURSOR))
{
gui_key_combo_buffer[0] = '\0';
- return 0;
+ goto end_no_input;
}
}
if (!signal_sent)
@@ -1531,48 +2001,48 @@ gui_key_pressed (const char *key_str)
gui_key_combo_buffer) == WEECHAT_RC_OK_EAT)
{
gui_key_combo_buffer[0] = '\0';
- return 0;
+ goto end_no_input;
}
}
}
- if (gui_key_is_complete (gui_key_combo_buffer))
+ if (rc_expand && key_name_alias && key_name_alias[0])
{
+ /* key is complete */
if (gui_key_debug)
{
- expanded_key = gui_key_get_expanded_name (gui_key_combo_buffer);
gui_chat_printf (
NULL,
- _("debug: %s\"%s%s%s\"%s -> %s\"%s%s%s\"%s (no key) -> %s"),
- /* raw code */
- GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS),
- GUI_COLOR(GUI_COLOR_CHAT),
- gui_key_combo_buffer,
- GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS),
- GUI_COLOR(GUI_COLOR_CHAT),
- /* expanded name */
- GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS),
- GUI_COLOR(GUI_COLOR_CHAT),
- expanded_key,
- GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS),
- GUI_COLOR(GUI_COLOR_CHAT),
- /* insert into input */
+ _("debug: \"%s\" -> %s (legacy: %s) -> %s (no key) -> %s"),
+ gui_key_combo_buffer, key_name, key_name_legacy,
+ key_name_alias,
(insert_into_input) ? _("insert into input") : _("ignored"));
- if (expanded_key)
- free (expanded_key);
}
gui_key_combo_buffer[0] = '\0';
}
/* in debug mode, don't insert anything in input */
if (gui_key_debug)
- return 0;
+ goto end_no_input;
/*
* if this is first key and not found (even partial) => return 1
* else return 0 (= silently discard sequence of bad keys)
*/
- return insert_into_input;
+ rc = insert_into_input;
+ goto end;
+
+end_no_input:
+ rc = 0;
+
+end:
+ if (key_name_legacy)
+ free (key_name_legacy);
+ if (key_name)
+ free (key_name);
+ if (key_name_alias)
+ free (key_name_alias);
+ return rc;
}
/*
@@ -2101,7 +2571,7 @@ gui_key_add_to_infolist (struct t_infolist *infolist, struct t_gui_key *key)
if (!infolist_new_var_string (ptr_item, "key_internal", key->key))
return 0;
- expanded_key = gui_key_get_expanded_name (key->key);
+ expanded_key = gui_key_expand_legacy (key->key);
if (expanded_key)
{
if (!infolist_new_var_string (ptr_item, "key", expanded_key))
diff --git a/src/gui/gui-key.h b/src/gui/gui-key.h
index 38074c43c..52d3ee326 100644
--- a/src/gui/gui-key.h
+++ b/src/gui/gui-key.h
@@ -90,7 +90,10 @@ extern void gui_key_init ();
extern int gui_key_search_context (const char *context);
extern void gui_key_grab_init (int grab_command, const char *delay);
extern char *gui_key_get_internal_code (const char *key);
-extern char *gui_key_get_expanded_name (const char *key);
+extern char *gui_key_expand_legacy (const char *key);
+extern int gui_key_expand (const char *key,
+ char **key_name, char **key_name_alias);
+extern char *gui_key_legacy_to_alias (const char *key);
extern int gui_key_is_safe (int context, const char *key);
extern struct t_gui_key *gui_key_new (struct t_gui_buffer *buffer,
int context,
diff --git a/tests/unit/gui/test-gui-key.cpp b/tests/unit/gui/test-gui-key.cpp
index 98735ca2e..82f6663c4 100644
--- a/tests/unit/gui/test-gui-key.cpp
+++ b/tests/unit/gui/test-gui-key.cpp
@@ -28,6 +28,32 @@ extern "C"
#include "src/gui/gui-key.h"
}
+#define WEE_CHECK_EXP_KEY(__rc, __key_name, __key_name_alias, __key) \
+ key_name = NULL; \
+ key_name_alias = NULL; \
+ LONGS_EQUAL(__rc, \
+ gui_key_expand (__key, &key_name, &key_name_alias)); \
+ if (__key_name == NULL) \
+ { \
+ POINTERS_EQUAL(NULL, key_name); \
+ } \
+ else \
+ { \
+ STRCMP_EQUAL(__key_name, key_name); \
+ } \
+ if (__key_name_alias == NULL) \
+ { \
+ POINTERS_EQUAL(NULL, key_name_alias); \
+ } \
+ else \
+ { \
+ STRCMP_EQUAL(__key_name_alias, key_name_alias); \
+ } \
+ if (key_name) \
+ free (key_name); \
+ if (key_name_alias) \
+ free (key_name_alias);
+
TEST_GROUP(GuiKey)
{
};
@@ -105,45 +131,721 @@ TEST(GuiKey, GetInternalCode)
WEE_TEST_STR("@chat:t", gui_key_get_internal_code ("@chat:t"));
- WEE_TEST_STR("\x01[A", gui_key_get_internal_code ("meta-A"));
- WEE_TEST_STR("\x01[a", gui_key_get_internal_code ("meta-a"));
+ WEE_TEST_STR("\001[A", gui_key_get_internal_code ("meta-A"));
+ WEE_TEST_STR("\001[a", gui_key_get_internal_code ("meta-a"));
- WEE_TEST_STR("\x01[[A", gui_key_get_internal_code ("meta2-A"));
- WEE_TEST_STR("\x01[[a", gui_key_get_internal_code ("meta2-a"));
+ WEE_TEST_STR("\001[[A", gui_key_get_internal_code ("meta2-A"));
+ WEE_TEST_STR("\001[[a", gui_key_get_internal_code ("meta2-a"));
/* ctrl-letter keys are forced to lower case */
- WEE_TEST_STR("\x01" "a", gui_key_get_internal_code ("ctrl-A"));
- WEE_TEST_STR("\x01" "a", gui_key_get_internal_code ("ctrl-a"));
+ WEE_TEST_STR("\001a", gui_key_get_internal_code ("ctrl-A"));
+ WEE_TEST_STR("\001a", gui_key_get_internal_code ("ctrl-a"));
WEE_TEST_STR(" ", gui_key_get_internal_code ("space"));
}
/*
* Tests functions:
- * gui_key_get_expanded_name
+ * gui_key_expand_legacy
*/
-TEST(GuiKey, GetExpandedName)
+TEST(GuiKey, ExpandLegacy)
{
char *str;
- WEE_TEST_STR(NULL, gui_key_get_expanded_name (NULL));
- WEE_TEST_STR("", gui_key_get_expanded_name (""));
- WEE_TEST_STR("A", gui_key_get_expanded_name ("A"));
- WEE_TEST_STR("a", gui_key_get_expanded_name ("a"));
+ WEE_TEST_STR(NULL, gui_key_expand_legacy (NULL));
+ WEE_TEST_STR("", gui_key_expand_legacy (""));
+ WEE_TEST_STR("A", gui_key_expand_legacy ("A"));
+ WEE_TEST_STR("a", gui_key_expand_legacy ("a"));
- WEE_TEST_STR("@chat:t", gui_key_get_expanded_name ("@chat:t"));
+ WEE_TEST_STR("@chat:t", gui_key_expand_legacy ("@chat:t"));
- WEE_TEST_STR("meta-A", gui_key_get_expanded_name ("\x01[A"));
- WEE_TEST_STR("meta-a", gui_key_get_expanded_name ("\x01[a"));
+ WEE_TEST_STR("meta-A", gui_key_expand_legacy ("\001[A"));
+ WEE_TEST_STR("meta-a", gui_key_expand_legacy ("\001[a"));
- WEE_TEST_STR("meta2-A", gui_key_get_expanded_name ("\x01[[A"));
- WEE_TEST_STR("meta2-a", gui_key_get_expanded_name ("\x01[[a"));
+ WEE_TEST_STR("meta2-A", gui_key_expand_legacy ("\001[[A"));
+ WEE_TEST_STR("meta2-a", gui_key_expand_legacy ("\001[[a"));
- WEE_TEST_STR("ctrl-A", gui_key_get_expanded_name ("\x01" "A"));
- WEE_TEST_STR("ctrl-a", gui_key_get_expanded_name ("\x01" "a"));
+ WEE_TEST_STR("ctrl-A", gui_key_expand_legacy ("\001A"));
+ WEE_TEST_STR("ctrl-a", gui_key_expand_legacy ("\001a"));
- WEE_TEST_STR("space", gui_key_get_expanded_name (" "));
+ WEE_TEST_STR("space", gui_key_expand_legacy (" "));
+}
+
+/*
+ * Tests functions:
+ * gui_key_expand
+ */
+
+TEST(GuiKey, Expand)
+{
+ char *key_name, *key_name_alias;
+
+ /* NULL key */
+ WEE_CHECK_EXP_KEY(0, NULL, NULL, NULL);
+
+ /* empty key */
+ WEE_CHECK_EXP_KEY(1, "", "", "");
+
+ /* NULL key names */
+ LONGS_EQUAL(1, gui_key_expand ("a", NULL, NULL));
+
+ /* invalid keys: incomplete */
+ WEE_CHECK_EXP_KEY(0, NULL, NULL, "\001");
+ WEE_CHECK_EXP_KEY(0, NULL, NULL, "\001[");
+ WEE_CHECK_EXP_KEY(0, NULL, NULL, "\001[O");
+ WEE_CHECK_EXP_KEY(0, NULL, NULL, "\001[[");
+ WEE_CHECK_EXP_KEY(0, NULL, NULL, "\001[[O");
+ WEE_CHECK_EXP_KEY(0, NULL, NULL, "\001[[1");
+ WEE_CHECK_EXP_KEY(0, NULL, NULL, "\001[[12");
+ WEE_CHECK_EXP_KEY(0, NULL, NULL, "\001[[123");
+ WEE_CHECK_EXP_KEY(0, NULL, NULL, "\001[[1;");
+ WEE_CHECK_EXP_KEY(0, NULL, NULL, "\001[[1;2");
+ WEE_CHECK_EXP_KEY(0, NULL, NULL, "\001[[2;3");
+ WEE_CHECK_EXP_KEY(0, NULL, NULL, "\001[[15;");
+ WEE_CHECK_EXP_KEY(0, NULL, NULL, "\001[[15;1");
+ WEE_CHECK_EXP_KEY(0, NULL, NULL, "\001[[[");
+
+ /* unknown sequence: kept as-is */
+ WEE_CHECK_EXP_KEY(1, "meta2-x", "meta2-x", "\001[[x");
+ WEE_CHECK_EXP_KEY(1, "meta2-é", "meta2-é", "\001[[é");
+
+ WEE_CHECK_EXP_KEY(1, "A", "A", "A");
+ WEE_CHECK_EXP_KEY(1, "a", "a", "a");
+ WEE_CHECK_EXP_KEY(1, "space", "space", " ");
+ WEE_CHECK_EXP_KEY(1, "comma", "comma", ",");
+
+ /* ctrl + key */
+ WEE_CHECK_EXP_KEY(1, "ctrl-a", "ctrl-a", "\001a");
+ WEE_CHECK_EXP_KEY(1, "ctrl-h", "backspace", "\001h");
+ WEE_CHECK_EXP_KEY(1, "ctrl-?", "backspace", "\001?");
+ WEE_CHECK_EXP_KEY(1, "ctrl-i", "tab", "\001i");
+ WEE_CHECK_EXP_KEY(1, "ctrl-j", "return", "\001j");
+ WEE_CHECK_EXP_KEY(1, "ctrl-m", "return", "\001m");
+ WEE_CHECK_EXP_KEY(1, "ctrl-z", "ctrl-z", "\001z");
+ WEE_CHECK_EXP_KEY(1, "ctrl-_", "ctrl-_", "\001_");
+
+ /* ctrl + key with upper case letter (auto-converted to lower case) */
+ WEE_CHECK_EXP_KEY(1, "ctrl-a", "ctrl-a", "\001A");
+ WEE_CHECK_EXP_KEY(1, "ctrl-h", "backspace", "\001H");
+ WEE_CHECK_EXP_KEY(1, "ctrl-i", "tab", "\001I");
+ WEE_CHECK_EXP_KEY(1, "ctrl-j", "return", "\001J");
+ WEE_CHECK_EXP_KEY(1, "ctrl-m", "return", "\001M");
+ WEE_CHECK_EXP_KEY(1, "ctrl-z", "ctrl-z", "\001Z");
+
+ /* ctrl + key then other letter */
+ WEE_CHECK_EXP_KEY(1, "ctrl-c,b", "ctrl-c,b", "\001cb");
+ WEE_CHECK_EXP_KEY(1, "ctrl-c,_", "ctrl-c,_", "\001c_");
+
+ /* alt + ctrl + key */
+ WEE_CHECK_EXP_KEY(1, "meta-ctrl-a", "meta-ctrl-a", "\001[\001a");
+ WEE_CHECK_EXP_KEY(1, "meta-ctrl-h", "meta-backspace", "\001[\001h");
+ WEE_CHECK_EXP_KEY(1, "meta-ctrl-?", "meta-backspace", "\001[\001?");
+ WEE_CHECK_EXP_KEY(1, "meta-ctrl-i", "meta-tab", "\001[\001i");
+ WEE_CHECK_EXP_KEY(1, "meta-ctrl-j", "meta-return", "\001[\001j");
+ WEE_CHECK_EXP_KEY(1, "meta-ctrl-m", "meta-return", "\001[\001m");
+ WEE_CHECK_EXP_KEY(1, "meta-ctrl-z", "meta-ctrl-z", "\001[\001z");
+ WEE_CHECK_EXP_KEY(1, "meta-ctrl-_", "meta-ctrl-_", "\001[\001_");
+
+ /* alt + key */
+ WEE_CHECK_EXP_KEY(1, "meta-A", "meta-A", "\001[A");
+ WEE_CHECK_EXP_KEY(1, "meta-a", "meta-a", "\001[a");
+ WEE_CHECK_EXP_KEY(1, "meta-É", "meta-É", "\001[É");
+ WEE_CHECK_EXP_KEY(1, "meta-é", "meta-é", "\001[é");
+ WEE_CHECK_EXP_KEY(1, "meta-Z", "meta-Z", "\001[Z");
+ WEE_CHECK_EXP_KEY(1, "meta-z", "meta-z", "\001[z");
+ WEE_CHECK_EXP_KEY(1, "meta-_", "meta-_", "\001[_");
+
+ /* 2 * alt + key */
+ WEE_CHECK_EXP_KEY(1, "meta-meta-A", "meta-meta-A", "\001[\001[A");
+ WEE_CHECK_EXP_KEY(1, "meta-meta-a", "meta-meta-a", "\001[\001[a");
+ WEE_CHECK_EXP_KEY(1, "meta-meta-É", "meta-meta-É", "\001[\001[É");
+ WEE_CHECK_EXP_KEY(1, "meta-meta-é", "meta-meta-é", "\001[\001[é");
+ WEE_CHECK_EXP_KEY(1, "meta-meta-Z", "meta-meta-Z", "\001[\001[Z");
+ WEE_CHECK_EXP_KEY(1, "meta-meta-z", "meta-meta-z", "\001[\001[z");
+ WEE_CHECK_EXP_KEY(1, "meta-meta-_", "meta-meta-_", "\001[\001[_");
+
+ /* 3 * alt + key */
+ WEE_CHECK_EXP_KEY(1, "meta-meta-meta-A", "meta-meta-meta-A", "\001[\001[\001[A");
+ WEE_CHECK_EXP_KEY(1, "meta-meta-meta-a", "meta-meta-meta-a", "\001[\001[\001[a");
+ WEE_CHECK_EXP_KEY(1, "meta-meta-meta-É", "meta-meta-meta-É", "\001[\001[\001[É");
+ WEE_CHECK_EXP_KEY(1, "meta-meta-meta-é", "meta-meta-meta-é", "\001[\001[\001[é");
+ WEE_CHECK_EXP_KEY(1, "meta-meta-meta-Z", "meta-meta-meta-Z", "\001[\001[\001[Z");
+ WEE_CHECK_EXP_KEY(1, "meta-meta-meta-z", "meta-meta-meta-z", "\001[\001[\001[z");
+ WEE_CHECK_EXP_KEY(1, "meta-meta-meta-_", "meta-meta-meta-_", "\001[\001[\001[_");
+
+ /* alt + key (meta2) */
+ WEE_CHECK_EXP_KEY(1, "meta2-Z", "shift-tab", "\001[[Z");
+
+ /* arrows */
+ WEE_CHECK_EXP_KEY(1, "meta2-A", "up", "\001[[A");
+ WEE_CHECK_EXP_KEY(1, "meta2-B", "down", "\001[[B");
+ WEE_CHECK_EXP_KEY(1, "meta2-C", "right", "\001[[C");
+ WEE_CHECK_EXP_KEY(1, "meta2-D", "left", "\001[[D");
+
+ /* shift + arrows, modifier = 2: 1 + 1=shift */
+ WEE_CHECK_EXP_KEY(1, "meta2-1;2A", "shift-up", "\001[[1;2A");
+ WEE_CHECK_EXP_KEY(1, "meta2-1;2B", "shift-down", "\001[[1;2B");
+ WEE_CHECK_EXP_KEY(1, "meta2-1;2C", "shift-right", "\001[[1;2C");
+ WEE_CHECK_EXP_KEY(1, "meta2-1;2D", "shift-left", "\001[[1;2D");
+
+ /* alt + arrows, modifier = 3: 1 + 2=alt */
+ WEE_CHECK_EXP_KEY(1, "meta2-1;3A", "meta-up", "\001[[1;3A");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-A", "meta-up", "\001[\001[[A");
+ WEE_CHECK_EXP_KEY(1, "meta2-1;3B", "meta-down", "\001[[1;3B");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-B", "meta-down", "\001[\001[[B");
+ WEE_CHECK_EXP_KEY(1, "meta2-1;3C", "meta-right", "\001[[1;3C");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-C", "meta-right", "\001[\001[[C");
+ WEE_CHECK_EXP_KEY(1, "meta2-1;3D", "meta-left", "\001[[1;3D");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-D", "meta-left", "\001[\001[[D");
+
+ /* 2 * alt + arrows, modifier = 3: 1 + 2=alt */
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-1;3A", "meta-meta-up", "\001[\001[[1;3A");
+ WEE_CHECK_EXP_KEY(1, "meta-meta-meta2-A", "meta-meta-up", "\001[\001[\001[[A");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-1;3B", "meta-meta-down", "\001[\001[[1;3B");
+ WEE_CHECK_EXP_KEY(1, "meta-meta-meta2-B", "meta-meta-down", "\001[\001[\001[[B");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-1;3C", "meta-meta-right", "\001[\001[[1;3C");
+ WEE_CHECK_EXP_KEY(1, "meta-meta-meta2-C", "meta-meta-right", "\001[\001[\001[[C");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-1;3D", "meta-meta-left", "\001[\001[[1;3D");
+ WEE_CHECK_EXP_KEY(1, "meta-meta-meta2-D", "meta-meta-left", "\001[\001[\001[[D");
+
+ /* 3 * alt + arrows, modifier = 3: 1 + 2=alt */
+ WEE_CHECK_EXP_KEY(1, "meta-meta-meta2-1;3A", "meta-meta-meta-up", "\001[\001[\001[[1;3A");
+ WEE_CHECK_EXP_KEY(1, "meta-meta-meta-meta2-A", "meta-meta-meta-up", "\001[\001[\001[\001[[A");
+ WEE_CHECK_EXP_KEY(1, "meta-meta-meta2-1;3B", "meta-meta-meta-down", "\001[\001[\001[[1;3B");
+ WEE_CHECK_EXP_KEY(1, "meta-meta-meta-meta2-B", "meta-meta-meta-down", "\001[\001[\001[\001[[B");
+ WEE_CHECK_EXP_KEY(1, "meta-meta-meta2-1;3C", "meta-meta-meta-right", "\001[\001[\001[[1;3C");
+ WEE_CHECK_EXP_KEY(1, "meta-meta-meta-meta2-C", "meta-meta-meta-right", "\001[\001[\001[\001[[C");
+ WEE_CHECK_EXP_KEY(1, "meta-meta-meta2-1;3D", "meta-meta-meta-left", "\001[\001[\001[[1;3D");
+ WEE_CHECK_EXP_KEY(1, "meta-meta-meta-meta2-D", "meta-meta-meta-left", "\001[\001[\001[\001[[D");
+
+ /* alt + shift + arrows, modifier = 4: 1 + 1=shift + 2=alt */
+ WEE_CHECK_EXP_KEY(1, "meta2-1;4A", "meta-shift-up", "\001[[1;4A");
+ WEE_CHECK_EXP_KEY(1, "meta2-1;4B", "meta-shift-down", "\001[[1;4B");
+ WEE_CHECK_EXP_KEY(1, "meta2-1;4C", "meta-shift-right", "\001[[1;4C");
+ WEE_CHECK_EXP_KEY(1, "meta2-1;4D", "meta-shift-left", "\001[[1;4D");
+
+ /* ctrl + arrows, modifier = 5: 1 + 4=ctrl */
+ WEE_CHECK_EXP_KEY(1, "meta2-1;5A", "ctrl-up", "\001[[1;5A");
+ WEE_CHECK_EXP_KEY(1, "meta2-a", "ctrl-up", "\001[Oa"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-1;5B", "ctrl-down", "\001[[1;5B");
+ WEE_CHECK_EXP_KEY(1, "meta2-b", "ctrl-down", "\001[Ob"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-1;5C", "ctrl-right", "\001[[1;5C");
+ WEE_CHECK_EXP_KEY(1, "meta2-c", "ctrl-right", "\001[Oc"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-1;5D", "ctrl-left", "\001[[1;5D");
+ WEE_CHECK_EXP_KEY(1, "meta2-d", "ctrl-left", "\001[Od"); /* urxvt */
+
+ /* ctrl + shift + arrows, modifier = 6: 1 + 1=shift + 4=ctrl */
+ WEE_CHECK_EXP_KEY(1, "meta2-1;6A", "ctrl-shift-up", "\001[[1;6A");
+ WEE_CHECK_EXP_KEY(1, "meta2-1;6B", "ctrl-shift-down", "\001[[1;6B");
+ WEE_CHECK_EXP_KEY(1, "meta2-1;6C", "ctrl-shift-right", "\001[[1;6C");
+ WEE_CHECK_EXP_KEY(1, "meta2-1;6D", "ctrl-shift-left", "\001[[1;6D");
+
+ /* ctrl + alt + arrows, modifier = 7: 1 + 2=alt + 4=ctrl */
+ WEE_CHECK_EXP_KEY(1, "meta2-1;7A", "meta-ctrl-up", "\001[[1;7A");
+ WEE_CHECK_EXP_KEY(1, "meta2-1;7B", "meta-ctrl-down", "\001[[1;7B");
+ WEE_CHECK_EXP_KEY(1, "meta2-1;7C", "meta-ctrl-right", "\001[[1;7C");
+ WEE_CHECK_EXP_KEY(1, "meta2-1;7D", "meta-ctrl-left", "\001[[1;7D");
+
+ /* ctrl + alt + arrows, modifier = 8: 1 + 1=shift + 2=alt + 4=ctrl */
+ WEE_CHECK_EXP_KEY(1, "meta2-1;8A", "meta-ctrl-shift-up", "\001[[1;8A");
+ WEE_CHECK_EXP_KEY(1, "meta2-1;8B", "meta-ctrl-shift-down", "\001[[1;8B");
+ WEE_CHECK_EXP_KEY(1, "meta2-1;8C", "meta-ctrl-shift-right", "\001[[1;8C");
+ WEE_CHECK_EXP_KEY(1, "meta2-1;8D", "meta-ctrl-shift-left", "\001[[1;8D");
+
+ /* home */
+ WEE_CHECK_EXP_KEY(1, "meta2-H", "home", "\001[[H");
+ WEE_CHECK_EXP_KEY(1, "meta2-1~", "home", "\001[[1~");
+ WEE_CHECK_EXP_KEY(1, "meta2-7~", "home", "\001[[7~"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-1;2H", "shift-home", "\001[[1;2H");
+ WEE_CHECK_EXP_KEY(1, "meta2-7$", "shift-home", "\001[[7$"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-1;3H", "meta-home", "\001[[1;3H");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-7~", "meta-home", "\001[\001[[7~"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-1;4H", "meta-shift-home", "\001[[1;4H");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-7$", "meta-shift-home", "\001[\001[[7$"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-1;5H", "ctrl-home", "\001[[1;5H");
+ WEE_CHECK_EXP_KEY(1, "meta2-7^", "ctrl-home", "\001[[7^"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-1;6H", "ctrl-shift-home", "\001[[1;6H");
+ WEE_CHECK_EXP_KEY(1, "meta2-7@", "ctrl-shift-home", "\001[[7@"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-1;7H", "meta-ctrl-home", "\001[[1;7H");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-7^", "meta-ctrl-home", "\001[\001[[7^"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-1;8H", "meta-ctrl-shift-home", "\001[[1;8H");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-7@", "meta-ctrl-shift-home", "\001[\001[[7@"); /* urxvt */
+
+ /* end */
+ WEE_CHECK_EXP_KEY(1, "meta2-F", "end", "\001[[F");
+ WEE_CHECK_EXP_KEY(1, "meta2-4~", "end", "\001[[4~");
+ WEE_CHECK_EXP_KEY(1, "meta2-8~", "end", "\001[[8~");
+ WEE_CHECK_EXP_KEY(1, "meta2-1;2F", "shift-end", "\001[[1;2F");
+ WEE_CHECK_EXP_KEY(1, "meta2-4;2~", "shift-end", "\001[[4;2~");
+ WEE_CHECK_EXP_KEY(1, "meta2-8;2~", "shift-end", "\001[[8;2~");
+ WEE_CHECK_EXP_KEY(1, "meta2-1;3F", "meta-end", "\001[[1;3F");
+ WEE_CHECK_EXP_KEY(1, "meta2-4;3~", "meta-end", "\001[[4;3~");
+ WEE_CHECK_EXP_KEY(1, "meta2-8;3~", "meta-end", "\001[[8;3~");
+ WEE_CHECK_EXP_KEY(1, "meta2-1;4F", "meta-shift-end", "\001[[1;4F");
+ WEE_CHECK_EXP_KEY(1, "meta2-4;4~", "meta-shift-end", "\001[[4;4~");
+ WEE_CHECK_EXP_KEY(1, "meta2-8;4~", "meta-shift-end", "\001[[8;4~");
+ WEE_CHECK_EXP_KEY(1, "meta2-1;5F", "ctrl-end", "\001[[1;5F");
+ WEE_CHECK_EXP_KEY(1, "meta2-4;5~", "ctrl-end", "\001[[4;5~");
+ WEE_CHECK_EXP_KEY(1, "meta2-8;5~", "ctrl-end", "\001[[8;5~");
+ WEE_CHECK_EXP_KEY(1, "meta2-1;6F", "ctrl-shift-end", "\001[[1;6F");
+ WEE_CHECK_EXP_KEY(1, "meta2-4;6~", "ctrl-shift-end", "\001[[4;6~");
+ WEE_CHECK_EXP_KEY(1, "meta2-8;6~", "ctrl-shift-end", "\001[[8;6~");
+ WEE_CHECK_EXP_KEY(1, "meta2-1;7F", "meta-ctrl-end", "\001[[1;7F");
+ WEE_CHECK_EXP_KEY(1, "meta2-4;7~", "meta-ctrl-end", "\001[[4;7~");
+ WEE_CHECK_EXP_KEY(1, "meta2-8;7~", "meta-ctrl-end", "\001[[8;7~");
+ WEE_CHECK_EXP_KEY(1, "meta2-1;8F", "meta-ctrl-shift-end", "\001[[1;8F");
+ WEE_CHECK_EXP_KEY(1, "meta2-4;8~", "meta-ctrl-shift-end", "\001[[4;8~");
+ WEE_CHECK_EXP_KEY(1, "meta2-8;8~", "meta-ctrl-shift-end", "\001[[8;8~");
+
+ /* insert */
+ WEE_CHECK_EXP_KEY(1, "meta2-2~", "insert", "\001[[2~");
+ WEE_CHECK_EXP_KEY(1, "meta2-2;2~", "shift-insert", "\001[[2;2~");
+ WEE_CHECK_EXP_KEY(1, "meta2-2$", "shift-insert", "\001[[2$"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-2;3~", "meta-insert", "\001[[2;3~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-2~", "meta-insert", "\001[\001[[2~"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-2;4~", "meta-shift-insert", "\001[[2;4~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-2$", "meta-shift-insert", "\001[\001[[2$"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-2;5~", "ctrl-insert", "\001[[2;5~");
+ WEE_CHECK_EXP_KEY(1, "meta2-2^", "ctrl-insert", "\001[[2^"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-2;6~", "ctrl-shift-insert", "\001[[2;6~");
+ WEE_CHECK_EXP_KEY(1, "meta2-2@", "ctrl-shift-insert", "\001[[2@"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-2;7~", "meta-ctrl-insert", "\001[[2;7~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-2^", "meta-ctrl-insert", "\001[\001[[2^"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-2;8~", "meta-ctrl-shift-insert", "\001[[2;8~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-2@", "meta-ctrl-shift-insert", "\001[\001[[2@"); /* urxvt */
+
+ /* delete */
+ WEE_CHECK_EXP_KEY(1, "meta2-3~", "delete", "\001[[3~");
+ WEE_CHECK_EXP_KEY(1, "meta2-3;2~", "shift-delete", "\001[[3;2~");
+ WEE_CHECK_EXP_KEY(1, "meta2-3$", "shift-delete", "\001[[3$"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-3;3~", "meta-delete", "\001[[3;3~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-3~", "meta-delete", "\001[\001[[3~"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-3;4~", "meta-shift-delete", "\001[[3;4~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-3$", "meta-shift-delete", "\001[\001[[3$"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-3;5~", "ctrl-delete", "\001[[3;5~");
+ WEE_CHECK_EXP_KEY(1, "meta2-3^", "ctrl-delete", "\001[[3^"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-3;6~", "ctrl-shift-delete", "\001[[3;6~");
+ WEE_CHECK_EXP_KEY(1, "meta2-3@", "ctrl-shift-delete", "\001[[3@"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-3;7~", "meta-ctrl-delete", "\001[[3;7~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-3^", "meta-ctrl-delete", "\001[\001[[3^"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-3;8~", "meta-ctrl-shift-delete", "\001[[3;8~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-3@", "meta-ctrl-shift-delete", "\001[\001[[3@"); /* urxvt */
+
+ /* pgup */
+ WEE_CHECK_EXP_KEY(1, "meta2-5~", "pgup", "\001[[5~");
+ WEE_CHECK_EXP_KEY(1, "meta2-I", "pgup", "\001[[I");
+ WEE_CHECK_EXP_KEY(1, "meta2-5;2~", "shift-pgup", "\001[[5;2~");
+ WEE_CHECK_EXP_KEY(1, "meta2-1;2I", "shift-pgup", "\001[[1;2I");
+ WEE_CHECK_EXP_KEY(1, "meta2-5;3~", "meta-pgup", "\001[[5;3~");
+ WEE_CHECK_EXP_KEY(1, "meta2-1;3I", "meta-pgup", "\001[[1;3I");
+ WEE_CHECK_EXP_KEY(1, "meta2-5;4~", "meta-shift-pgup", "\001[[5;4~");
+ WEE_CHECK_EXP_KEY(1, "meta2-1;4I", "meta-shift-pgup", "\001[[1;4I");
+ WEE_CHECK_EXP_KEY(1, "meta2-5;5~", "ctrl-pgup", "\001[[5;5~");
+ WEE_CHECK_EXP_KEY(1, "meta2-1;5I", "ctrl-pgup", "\001[[1;5I");
+ WEE_CHECK_EXP_KEY(1, "meta2-5;6~", "ctrl-shift-pgup", "\001[[5;6~");
+ WEE_CHECK_EXP_KEY(1, "meta2-1;6I", "ctrl-shift-pgup", "\001[[1;6I");
+ WEE_CHECK_EXP_KEY(1, "meta2-5;7~", "meta-ctrl-pgup", "\001[[5;7~");
+ WEE_CHECK_EXP_KEY(1, "meta2-1;7I", "meta-ctrl-pgup", "\001[[1;7I");
+ WEE_CHECK_EXP_KEY(1, "meta2-5;8~", "meta-ctrl-shift-pgup", "\001[[5;8~");
+ WEE_CHECK_EXP_KEY(1, "meta2-1;8I", "meta-ctrl-shift-pgup", "\001[[1;8I");
+
+ /* pgdn */
+ WEE_CHECK_EXP_KEY(1, "meta2-6~", "pgdn", "\001[[6~");
+ WEE_CHECK_EXP_KEY(1, "meta2-G", "pgdn", "\001[[G");
+ WEE_CHECK_EXP_KEY(1, "meta2-6;2~", "shift-pgdn", "\001[[6;2~");
+ WEE_CHECK_EXP_KEY(1, "meta2-1;2G", "shift-pgdn", "\001[[1;2G");
+ WEE_CHECK_EXP_KEY(1, "meta2-6;3~", "meta-pgdn", "\001[[6;3~");
+ WEE_CHECK_EXP_KEY(1, "meta2-1;3G", "meta-pgdn", "\001[[1;3G");
+ WEE_CHECK_EXP_KEY(1, "meta2-6;4~", "meta-shift-pgdn", "\001[[6;4~");
+ WEE_CHECK_EXP_KEY(1, "meta2-1;4G", "meta-shift-pgdn", "\001[[1;4G");
+ WEE_CHECK_EXP_KEY(1, "meta2-6;5~", "ctrl-pgdn", "\001[[6;5~");
+ WEE_CHECK_EXP_KEY(1, "meta2-1;5G", "ctrl-pgdn", "\001[[1;5G");
+ WEE_CHECK_EXP_KEY(1, "meta2-6;6~", "ctrl-shift-pgdn", "\001[[6;6~");
+ WEE_CHECK_EXP_KEY(1, "meta2-1;6G", "ctrl-shift-pgdn", "\001[[1;6G");
+ WEE_CHECK_EXP_KEY(1, "meta2-6;7~", "meta-ctrl-pgdn", "\001[[6;7~");
+ WEE_CHECK_EXP_KEY(1, "meta2-1;7G", "meta-ctrl-pgdn", "\001[[1;7G");
+ WEE_CHECK_EXP_KEY(1, "meta2-6;8~", "meta-ctrl-shift-pgdn", "\001[[6;8~");
+ WEE_CHECK_EXP_KEY(1, "meta2-1;8G", "meta-ctrl-shift-pgdn", "\001[[1;8G");
+
+ /* f1 */
+ WEE_CHECK_EXP_KEY(1, "meta2-P", "f1", "\001[OP");
+ WEE_CHECK_EXP_KEY(1, "meta2-11~", "f1", "\001[[11~"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-[A", "f1", "\001[[[A"); /* Linux console */
+ WEE_CHECK_EXP_KEY(1, "meta2-1;2P", "shift-f1", "\001[[1;2P");
+ WEE_CHECK_EXP_KEY(1, "meta2-11$", "shift-f1", "\001[[11$"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-1;3P", "meta-f1", "\001[[1;3P");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-11~", "meta-f1", "\001[\001[[11~"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-1;4P", "meta-shift-f1", "\001[[1;4P");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-11$", "meta-shift-f1", "\001[\001[[11$"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-1;5P", "ctrl-f1", "\001[[1;5P");
+ WEE_CHECK_EXP_KEY(1, "meta2-11^", "ctrl-f1", "\001[[11^"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-1;6P", "ctrl-shift-f1", "\001[[1;6P");
+ WEE_CHECK_EXP_KEY(1, "meta2-11@", "ctrl-shift-f1", "\001[[11@"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-1;7P", "meta-ctrl-f1", "\001[[1;7P");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-11^", "meta-ctrl-f1", "\001[\001[[11^"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-1;8P", "meta-ctrl-shift-f1", "\001[[1;8P");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-11@", "meta-ctrl-shift-f1", "\001[\001[[11@"); /* urxvt */
+
+ /* f2 */
+ WEE_CHECK_EXP_KEY(1, "meta2-Q", "f2", "\001[OQ");
+ WEE_CHECK_EXP_KEY(1, "meta2-12~", "f2", "\001[[12~"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-[B", "f2", "\001[[[B"); /* Linux console */
+ WEE_CHECK_EXP_KEY(1, "meta2-1;2Q", "shift-f2", "\001[[1;2Q");
+ WEE_CHECK_EXP_KEY(1, "meta2-12$", "shift-f2", "\001[[12$"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-1;3Q", "meta-f2", "\001[[1;3Q");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-12~", "meta-f2", "\001[\001[[12~"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-1;4Q", "meta-shift-f2", "\001[[1;4Q");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-12$", "meta-shift-f2", "\001[\001[[12$"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-1;5Q", "ctrl-f2", "\001[[1;5Q");
+ WEE_CHECK_EXP_KEY(1, "meta2-12^", "ctrl-f2", "\001[[12^"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-1;6Q", "ctrl-shift-f2", "\001[[1;6Q");
+ WEE_CHECK_EXP_KEY(1, "meta2-12@", "ctrl-shift-f2", "\001[[12@"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-1;7Q", "meta-ctrl-f2", "\001[[1;7Q");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-12^", "meta-ctrl-f2", "\001[\001[[12^"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-1;8Q", "meta-ctrl-shift-f2", "\001[[1;8Q");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-12@", "meta-ctrl-shift-f2", "\001[\001[[12@"); /* urxvt */
+
+ /* f3 */
+ WEE_CHECK_EXP_KEY(1, "meta2-R", "f3", "\001[OR");
+ WEE_CHECK_EXP_KEY(1, "meta2-13~", "f3", "\001[[13~"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-[C", "f3", "\001[[[C"); /* Linux console */
+ WEE_CHECK_EXP_KEY(1, "meta2-1;2R", "shift-f3", "\001[[1;2R");
+ WEE_CHECK_EXP_KEY(1, "meta2-13$", "shift-f3", "\001[[13$"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-1;3R", "meta-f3", "\001[[1;3R");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-13~", "meta-f3", "\001[\001[[13~"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-1;4R", "meta-shift-f3", "\001[[1;4R");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-13$", "meta-shift-f3", "\001[\001[[13$"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-1;5R", "ctrl-f3", "\001[[1;5R");
+ WEE_CHECK_EXP_KEY(1, "meta2-13^", "ctrl-f3", "\001[[13^"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-1;6R", "ctrl-shift-f3", "\001[[1;6R");
+ WEE_CHECK_EXP_KEY(1, "meta2-13@", "ctrl-shift-f3", "\001[[13@"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-1;7R", "meta-ctrl-f3", "\001[[1;7R");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-13^", "meta-ctrl-f3", "\001[\001[[13^"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-1;8R", "meta-ctrl-shift-f3", "\001[[1;8R");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-13@", "meta-ctrl-shift-f3", "\001[\001[[13@"); /* urxvt */
+
+ /* f4 */
+ WEE_CHECK_EXP_KEY(1, "meta2-S", "f4", "\001[OS");
+ WEE_CHECK_EXP_KEY(1, "meta2-14~", "f4", "\001[[14~"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-[D", "f4", "\001[[[D"); /* Linux console */
+ WEE_CHECK_EXP_KEY(1, "meta2-1;2S", "shift-f4", "\001[[1;2S");
+ WEE_CHECK_EXP_KEY(1, "meta2-14$", "shift-f4", "\001[[14$"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-1;3S", "meta-f4", "\001[[1;3S");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-14~", "meta-f4", "\001[\001[[14~"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-1;4S", "meta-shift-f4", "\001[[1;4S");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-14$", "meta-shift-f4", "\001[\001[[14$"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-1;5S", "ctrl-f4", "\001[[1;5S");
+ WEE_CHECK_EXP_KEY(1, "meta2-14^", "ctrl-f4", "\001[[14^"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-1;6S", "ctrl-shift-f4", "\001[[1;6S");
+ WEE_CHECK_EXP_KEY(1, "meta2-14@", "ctrl-shift-f4", "\001[[14@"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-1;7S", "meta-ctrl-f4", "\001[[1;7S");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-14^", "meta-ctrl-f4", "\001[\001[[14^"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-1;8S", "meta-ctrl-shift-f4", "\001[[1;8S");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-14@", "meta-ctrl-shift-f4", "\001[\001[[14@"); /* urxvt */
+
+ /* f5 */
+ WEE_CHECK_EXP_KEY(1, "meta2-15~", "f5", "\001[[15~");
+ WEE_CHECK_EXP_KEY(1, "meta2-[E", "f5", "\001[[[E"); /* Linux console */
+ WEE_CHECK_EXP_KEY(1, "meta2-15;2~", "shift-f5", "\001[[15;2~");
+ WEE_CHECK_EXP_KEY(1, "meta2-15$", "shift-f5", "\001[[15$"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-15;3~", "meta-f5", "\001[[15;3~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-15~", "meta-f5", "\001[\001[[15~"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-15;4~", "meta-shift-f5", "\001[[15;4~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-15$", "meta-shift-f5", "\001[\001[[15$"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-15;5~", "ctrl-f5", "\001[[15;5~");
+ WEE_CHECK_EXP_KEY(1, "meta2-15^", "ctrl-f5", "\001[[15^"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-15;6~", "ctrl-shift-f5", "\001[[15;6~");
+ WEE_CHECK_EXP_KEY(1, "meta2-15@", "ctrl-shift-f5", "\001[[15@"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-15;7~", "meta-ctrl-f5", "\001[[15;7~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-15^", "meta-ctrl-f5", "\001[\001[[15^"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-15;8~", "meta-ctrl-shift-f5", "\001[[15;8~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-15@", "meta-ctrl-shift-f5", "\001[\001[[15@"); /* urxvt */
+
+ /* f6 */
+ WEE_CHECK_EXP_KEY(1, "meta2-17~", "f6", "\001[[17~");
+ WEE_CHECK_EXP_KEY(1, "meta2-17;2~", "shift-f6", "\001[[17;2~");
+ WEE_CHECK_EXP_KEY(1, "meta2-17$", "shift-f6", "\001[[17$"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-17;3~", "meta-f6", "\001[[17;3~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-17~", "meta-f6", "\001[\001[[17~"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-17;4~", "meta-shift-f6", "\001[[17;4~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-17$", "meta-shift-f6", "\001[\001[[17$"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-17;5~", "ctrl-f6", "\001[[17;5~");
+ WEE_CHECK_EXP_KEY(1, "meta2-17^", "ctrl-f6", "\001[[17^"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-17;6~", "ctrl-shift-f6", "\001[[17;6~");
+ WEE_CHECK_EXP_KEY(1, "meta2-17@", "ctrl-shift-f6", "\001[[17@"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-17;7~", "meta-ctrl-f6", "\001[[17;7~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-17^", "meta-ctrl-f6", "\001[\001[[17^"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-17;8~", "meta-ctrl-shift-f6", "\001[[17;8~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-17@", "meta-ctrl-shift-f6", "\001[\001[[17@"); /* urxvt */
+
+ /* f7 */
+ WEE_CHECK_EXP_KEY(1, "meta2-18~", "f7", "\001[[18~");
+ WEE_CHECK_EXP_KEY(1, "meta2-18;2~", "shift-f7", "\001[[18;2~");
+ WEE_CHECK_EXP_KEY(1, "meta2-18$", "shift-f7", "\001[[18$"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-18;3~", "meta-f7", "\001[[18;3~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-18~", "meta-f7", "\001[\001[[18~"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-18;4~", "meta-shift-f7", "\001[[18;4~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-18$", "meta-shift-f7", "\001[\001[[18$"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-18;5~", "ctrl-f7", "\001[[18;5~");
+ WEE_CHECK_EXP_KEY(1, "meta2-18^", "ctrl-f7", "\001[[18^"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-18;6~", "ctrl-shift-f7", "\001[[18;6~");
+ WEE_CHECK_EXP_KEY(1, "meta2-18@", "ctrl-shift-f7", "\001[[18@"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-18;7~", "meta-ctrl-f7", "\001[[18;7~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-18^", "meta-ctrl-f7", "\001[\001[[18^"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-18;8~", "meta-ctrl-shift-f7", "\001[[18;8~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-18@", "meta-ctrl-shift-f7", "\001[\001[[18@"); /* urxvt */
+
+ /* f8 */
+ WEE_CHECK_EXP_KEY(1, "meta2-19~", "f8", "\001[[19~");
+ WEE_CHECK_EXP_KEY(1, "meta2-19;2~", "shift-f8", "\001[[19;2~");
+ WEE_CHECK_EXP_KEY(1, "meta2-19$", "shift-f8", "\001[[19$"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-19;3~", "meta-f8", "\001[[19;3~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-19~", "meta-f8", "\001[\001[[19~"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-19;4~", "meta-shift-f8", "\001[[19;4~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-19$", "meta-shift-f8", "\001[\001[[19$"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-19;5~", "ctrl-f8", "\001[[19;5~");
+ WEE_CHECK_EXP_KEY(1, "meta2-19^", "ctrl-f8", "\001[[19^"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-19;6~", "ctrl-shift-f8", "\001[[19;6~");
+ WEE_CHECK_EXP_KEY(1, "meta2-19@", "ctrl-shift-f8", "\001[[19@"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-19;7~", "meta-ctrl-f8", "\001[[19;7~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-19^", "meta-ctrl-f8", "\001[\001[[19^"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-19;8~", "meta-ctrl-shift-f8", "\001[[19;8~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-19@", "meta-ctrl-shift-f8", "\001[\001[[19@"); /* urxvt */
+
+ /* f9 */
+ WEE_CHECK_EXP_KEY(1, "meta2-20~", "f9", "\001[[20~");
+ WEE_CHECK_EXP_KEY(1, "meta2-20;2~", "shift-f9", "\001[[20;2~");
+ WEE_CHECK_EXP_KEY(1, "meta2-20$", "shift-f9", "\001[[20$"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-20;3~", "meta-f9", "\001[[20;3~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-20~", "meta-f9", "\001[\001[[20~"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-20;4~", "meta-shift-f9", "\001[[20;4~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-20$", "meta-shift-f9", "\001[\001[[20$"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-20;5~", "ctrl-f9", "\001[[20;5~");
+ WEE_CHECK_EXP_KEY(1, "meta2-20^", "ctrl-f9", "\001[[20^"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-20;6~", "ctrl-shift-f9", "\001[[20;6~");
+ WEE_CHECK_EXP_KEY(1, "meta2-20@", "ctrl-shift-f9", "\001[[20@"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-20;7~", "meta-ctrl-f9", "\001[[20;7~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-20^", "meta-ctrl-f9", "\001[\001[[20^"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-20;8~", "meta-ctrl-shift-f9", "\001[[20;8~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-20@", "meta-ctrl-shift-f9", "\001[\001[[20@"); /* urxvt */
+
+ /* f10 */
+ WEE_CHECK_EXP_KEY(1, "meta2-21~", "f10", "\001[[21~");
+ WEE_CHECK_EXP_KEY(1, "meta2-21;2~", "shift-f10", "\001[[21;2~");
+ WEE_CHECK_EXP_KEY(1, "meta2-21$", "shift-f10", "\001[[21$"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-21;3~", "meta-f10", "\001[[21;3~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-21~", "meta-f10", "\001[\001[[21~"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-21;4~", "meta-shift-f10", "\001[[21;4~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-21$", "meta-shift-f10", "\001[\001[[21$"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-21;5~", "ctrl-f10", "\001[[21;5~");
+ WEE_CHECK_EXP_KEY(1, "meta2-21^", "ctrl-f10", "\001[[21^"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-21;6~", "ctrl-shift-f10", "\001[[21;6~");
+ WEE_CHECK_EXP_KEY(1, "meta2-21@", "ctrl-shift-f10", "\001[[21@"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-21;7~", "meta-ctrl-f10", "\001[[21;7~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-21^", "meta-ctrl-f10", "\001[\001[[21^"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-21;8~", "meta-ctrl-shift-f10", "\001[[21;8~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-21@", "meta-ctrl-shift-f10", "\001[\001[[21@"); /* urxvt */
+
+ /* f11 */
+ WEE_CHECK_EXP_KEY(1, "meta2-23~", "f11", "\001[[23~");
+ WEE_CHECK_EXP_KEY(1, "meta2-23;2~", "shift-f11", "\001[[23;2~");
+ WEE_CHECK_EXP_KEY(1, "meta2-23$", "shift-f11", "\001[[23$"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-23;3~", "meta-f11", "\001[[23;3~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-23~", "meta-f11", "\001[\001[[23~"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-23;4~", "meta-shift-f11", "\001[[23;4~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-23$", "meta-shift-f11", "\001[\001[[23$"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-23;5~", "ctrl-f11", "\001[[23;5~");
+ WEE_CHECK_EXP_KEY(1, "meta2-23^", "ctrl-f11", "\001[[23^"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-23;6~", "ctrl-shift-f11", "\001[[23;6~");
+ WEE_CHECK_EXP_KEY(1, "meta2-23@", "ctrl-shift-f11", "\001[[23@"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-23;7~", "meta-ctrl-f11", "\001[[23;7~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-23^", "meta-ctrl-f11", "\001[\001[[23^"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-23;8~", "meta-ctrl-shift-f11", "\001[[23;8~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-23@", "meta-ctrl-shift-f11", "\001[\001[[23@"); /* urxvt */
+
+ /* f12 */
+ WEE_CHECK_EXP_KEY(1, "meta2-24~", "f12", "\001[[24~");
+ WEE_CHECK_EXP_KEY(1, "meta2-24;2~", "shift-f12", "\001[[24;2~");
+ WEE_CHECK_EXP_KEY(1, "meta2-24$", "shift-f12", "\001[[24$"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-24;3~", "meta-f12", "\001[[24;3~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-24~", "meta-f12", "\001[\001[[24~"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-24;4~", "meta-shift-f12", "\001[[24;4~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-24$", "meta-shift-f12", "\001[\001[[24$"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-24;5~", "ctrl-f12", "\001[[24;5~");
+ WEE_CHECK_EXP_KEY(1, "meta2-24^", "ctrl-f12", "\001[[24^"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-24;6~", "ctrl-shift-f12", "\001[[24;6~");
+ WEE_CHECK_EXP_KEY(1, "meta2-24@", "ctrl-shift-f12", "\001[[24@"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-24;7~", "meta-ctrl-f12", "\001[[24;7~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-24^", "meta-ctrl-f12", "\001[\001[[24^"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-24;8~", "meta-ctrl-shift-f12", "\001[[24;8~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-24@", "meta-ctrl-shift-f12", "\001[\001[[24@"); /* urxvt */
+
+ /* f13 */
+ WEE_CHECK_EXP_KEY(1, "meta2-25~", "f13", "\001[[25~");
+ WEE_CHECK_EXP_KEY(1, "meta2-25;2~", "shift-f13", "\001[[25;2~");
+ WEE_CHECK_EXP_KEY(1, "meta2-25$", "shift-f13", "\001[[25$"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-25;3~", "meta-f13", "\001[[25;3~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-25~", "meta-f13", "\001[\001[[25~"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-25;4~", "meta-shift-f13", "\001[[25;4~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-25$", "meta-shift-f13", "\001[\001[[25$"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-25;5~", "ctrl-f13", "\001[[25;5~");
+ WEE_CHECK_EXP_KEY(1, "meta2-25^", "ctrl-f13", "\001[[25^"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-25;6~", "ctrl-shift-f13", "\001[[25;6~");
+ WEE_CHECK_EXP_KEY(1, "meta2-25@", "ctrl-shift-f13", "\001[[25@"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-25;7~", "meta-ctrl-f13", "\001[[25;7~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-25^", "meta-ctrl-f13", "\001[\001[[25^"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-25;8~", "meta-ctrl-shift-f13", "\001[[25;8~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-25@", "meta-ctrl-shift-f13", "\001[\001[[25@"); /* urxvt */
+
+ /* f14 */
+ WEE_CHECK_EXP_KEY(1, "meta2-26~", "f14", "\001[[26~");
+ WEE_CHECK_EXP_KEY(1, "meta2-26;2~", "shift-f14", "\001[[26;2~");
+ WEE_CHECK_EXP_KEY(1, "meta2-26$", "shift-f14", "\001[[26$"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-26;3~", "meta-f14", "\001[[26;3~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-26~", "meta-f14", "\001[\001[[26~"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-26;4~", "meta-shift-f14", "\001[[26;4~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-26$", "meta-shift-f14", "\001[\001[[26$"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-26;5~", "ctrl-f14", "\001[[26;5~");
+ WEE_CHECK_EXP_KEY(1, "meta2-26^", "ctrl-f14", "\001[[26^"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-26;6~", "ctrl-shift-f14", "\001[[26;6~");
+ WEE_CHECK_EXP_KEY(1, "meta2-26@", "ctrl-shift-f14", "\001[[26@"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-26;7~", "meta-ctrl-f14", "\001[[26;7~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-26^", "meta-ctrl-f14", "\001[\001[[26^"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-26;8~", "meta-ctrl-shift-f14", "\001[[26;8~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-26@", "meta-ctrl-shift-f14", "\001[\001[[26@"); /* urxvt */
+
+ /* f15 */
+ WEE_CHECK_EXP_KEY(1, "meta2-28~", "f15", "\001[[28~");
+ WEE_CHECK_EXP_KEY(1, "meta2-28;2~", "shift-f15", "\001[[28;2~");
+ WEE_CHECK_EXP_KEY(1, "meta2-28$", "shift-f15", "\001[[28$"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-28;3~", "meta-f15", "\001[[28;3~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-28~", "meta-f15", "\001[\001[[28~"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-28;4~", "meta-shift-f15", "\001[[28;4~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-28$", "meta-shift-f15", "\001[\001[[28$"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-28;5~", "ctrl-f15", "\001[[28;5~");
+ WEE_CHECK_EXP_KEY(1, "meta2-28^", "ctrl-f15", "\001[[28^"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-28;6~", "ctrl-shift-f15", "\001[[28;6~");
+ WEE_CHECK_EXP_KEY(1, "meta2-28@", "ctrl-shift-f15", "\001[[28@"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-28;7~", "meta-ctrl-f15", "\001[[28;7~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-28^", "meta-ctrl-f15", "\001[\001[[28^"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-28;8~", "meta-ctrl-shift-f15", "\001[[28;8~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-28@", "meta-ctrl-shift-f15", "\001[\001[[28@"); /* urxvt */
+
+ /* f16 */
+ WEE_CHECK_EXP_KEY(1, "meta2-29~", "f16", "\001[[29~");
+ WEE_CHECK_EXP_KEY(1, "meta2-29;2~", "shift-f16", "\001[[29;2~");
+ WEE_CHECK_EXP_KEY(1, "meta2-29$", "shift-f16", "\001[[29$"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-29;3~", "meta-f16", "\001[[29;3~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-29~", "meta-f16", "\001[\001[[29~"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-29;4~", "meta-shift-f16", "\001[[29;4~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-29$", "meta-shift-f16", "\001[\001[[29$"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-29;5~", "ctrl-f16", "\001[[29;5~");
+ WEE_CHECK_EXP_KEY(1, "meta2-29^", "ctrl-f16", "\001[[29^"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-29;6~", "ctrl-shift-f16", "\001[[29;6~");
+ WEE_CHECK_EXP_KEY(1, "meta2-29@", "ctrl-shift-f16", "\001[[29@"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-29;7~", "meta-ctrl-f16", "\001[[29;7~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-29^", "meta-ctrl-f16", "\001[\001[[29^"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-29;8~", "meta-ctrl-shift-f16", "\001[[29;8~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-29@", "meta-ctrl-shift-f16", "\001[\001[[29@"); /* urxvt */
+
+ /* f17 */
+ WEE_CHECK_EXP_KEY(1, "meta2-31~", "f17", "\001[[31~");
+ WEE_CHECK_EXP_KEY(1, "meta2-31;2~", "shift-f17", "\001[[31;2~");
+ WEE_CHECK_EXP_KEY(1, "meta2-31$", "shift-f17", "\001[[31$"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-31;3~", "meta-f17", "\001[[31;3~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-31~", "meta-f17", "\001[\001[[31~"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-31;4~", "meta-shift-f17", "\001[[31;4~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-31$", "meta-shift-f17", "\001[\001[[31$"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-31;5~", "ctrl-f17", "\001[[31;5~");
+ WEE_CHECK_EXP_KEY(1, "meta2-31^", "ctrl-f17", "\001[[31^"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-31;6~", "ctrl-shift-f17", "\001[[31;6~");
+ WEE_CHECK_EXP_KEY(1, "meta2-31@", "ctrl-shift-f17", "\001[[31@"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-31;7~", "meta-ctrl-f17", "\001[[31;7~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-31^", "meta-ctrl-f17", "\001[\001[[31^"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-31;8~", "meta-ctrl-shift-f17", "\001[[31;8~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-31@", "meta-ctrl-shift-f17", "\001[\001[[31@"); /* urxvt */
+
+ /* f18 */
+ WEE_CHECK_EXP_KEY(1, "meta2-32~", "f18", "\001[[32~");
+ WEE_CHECK_EXP_KEY(1, "meta2-32;2~", "shift-f18", "\001[[32;2~");
+ WEE_CHECK_EXP_KEY(1, "meta2-32$", "shift-f18", "\001[[32$"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-32;3~", "meta-f18", "\001[[32;3~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-32~", "meta-f18", "\001[\001[[32~"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-32;4~", "meta-shift-f18", "\001[[32;4~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-32$", "meta-shift-f18", "\001[\001[[32$"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-32;5~", "ctrl-f18", "\001[[32;5~");
+ WEE_CHECK_EXP_KEY(1, "meta2-32^", "ctrl-f18", "\001[[32^"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-32;6~", "ctrl-shift-f18", "\001[[32;6~");
+ WEE_CHECK_EXP_KEY(1, "meta2-32@", "ctrl-shift-f18", "\001[[32@"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-32;7~", "meta-ctrl-f18", "\001[[32;7~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-32^", "meta-ctrl-f18", "\001[\001[[32^"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-32;8~", "meta-ctrl-shift-f18", "\001[[32;8~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-32@", "meta-ctrl-shift-f18", "\001[\001[[32@"); /* urxvt */
+
+ /* f19 */
+ WEE_CHECK_EXP_KEY(1, "meta2-33~", "f19", "\001[[33~");
+ WEE_CHECK_EXP_KEY(1, "meta2-33;2~", "shift-f19", "\001[[33;2~");
+ WEE_CHECK_EXP_KEY(1, "meta2-33$", "shift-f19", "\001[[33$"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-33;3~", "meta-f19", "\001[[33;3~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-33~", "meta-f19", "\001[\001[[33~"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-33;4~", "meta-shift-f19", "\001[[33;4~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-33$", "meta-shift-f19", "\001[\001[[33$"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-33;5~", "ctrl-f19", "\001[[33;5~");
+ WEE_CHECK_EXP_KEY(1, "meta2-33^", "ctrl-f19", "\001[[33^"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-33;6~", "ctrl-shift-f19", "\001[[33;6~");
+ WEE_CHECK_EXP_KEY(1, "meta2-33@", "ctrl-shift-f19", "\001[[33@"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-33;7~", "meta-ctrl-f19", "\001[[33;7~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-33^", "meta-ctrl-f19", "\001[\001[[33^"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-33;8~", "meta-ctrl-shift-f19", "\001[[33;8~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-33@", "meta-ctrl-shift-f19", "\001[\001[[33@"); /* urxvt */
+
+ /* f20 */
+ WEE_CHECK_EXP_KEY(1, "meta2-34~", "f20", "\001[[34~");
+ WEE_CHECK_EXP_KEY(1, "meta2-34;2~", "shift-f20", "\001[[34;2~");
+ WEE_CHECK_EXP_KEY(1, "meta2-34$", "shift-f20", "\001[[34$"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-34;3~", "meta-f20", "\001[[34;3~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-34~", "meta-f20", "\001[\001[[34~"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-34;4~", "meta-shift-f20", "\001[[34;4~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-34$", "meta-shift-f20", "\001[\001[[34$"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-34;5~", "ctrl-f20", "\001[[34;5~");
+ WEE_CHECK_EXP_KEY(1, "meta2-34^", "ctrl-f20", "\001[[34^"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-34;6~", "ctrl-shift-f20", "\001[[34;6~");
+ WEE_CHECK_EXP_KEY(1, "meta2-34@", "ctrl-shift-f20", "\001[[34@"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-34;7~", "meta-ctrl-f20", "\001[[34;7~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-34^", "meta-ctrl-f20", "\001[\001[[34^"); /* urxvt */
+ WEE_CHECK_EXP_KEY(1, "meta2-34;8~", "meta-ctrl-shift-f20", "\001[[34;8~");
+ WEE_CHECK_EXP_KEY(1, "meta-meta2-34@", "meta-ctrl-shift-f20", "\001[\001[[34@"); /* urxvt */
+}
+
+/*
+ * Tests functions:
+ * gui_key_legacy_to_alias
+ */
+
+TEST(GuiKey, LegacyToAlias)
+{
+ char *str;
+
+ WEE_TEST_STR(NULL, gui_key_legacy_to_alias (NULL));
+ WEE_TEST_STR("", gui_key_legacy_to_alias (""));
+
+ WEE_TEST_STR("", gui_key_legacy_to_alias ("ctrl-"));
+ WEE_TEST_STR("", gui_key_legacy_to_alias ("meta-"));
+ WEE_TEST_STR("", gui_key_legacy_to_alias ("meta2-"));
+
+ WEE_TEST_STR("ctrl-a", gui_key_legacy_to_alias ("ctrl-A"));
+ WEE_TEST_STR("ctrl-a", gui_key_legacy_to_alias ("ctrl-a"));
+ WEE_TEST_STR("return", gui_key_legacy_to_alias ("ctrl-j"));
+ WEE_TEST_STR("return", gui_key_legacy_to_alias ("ctrl-m"));
+ WEE_TEST_STR("ctrl-c,b", gui_key_legacy_to_alias ("ctrl-cb"));
+ WEE_TEST_STR("meta-space", gui_key_legacy_to_alias ("meta-space"));
+ WEE_TEST_STR("meta-c,o,m,m,a", gui_key_legacy_to_alias ("meta-comma"));
+ WEE_TEST_STR("meta-comma", gui_key_legacy_to_alias ("meta-,"));
+ WEE_TEST_STR("meta-comma,x", gui_key_legacy_to_alias ("meta-,x"));
+ WEE_TEST_STR("meta-left", gui_key_legacy_to_alias ("meta2-1;3D"));
+ WEE_TEST_STR("meta-w,meta-up", gui_key_legacy_to_alias ("meta-wmeta2-1;3A"));
+ WEE_TEST_STR("meta-w,comma,meta-u,p", gui_key_legacy_to_alias ("meta-w,meta-up"));
}
/*
@@ -318,16 +1020,6 @@ TEST(GuiKey, Focus)
/*
* Tests functions:
- * gui_key_is_complete
- */
-
-TEST(GuiKey, IsComplete)
-{
- /* TODO: write tests */
-}
-
-/*
- * Tests functions:
* gui_key_pressed
*/