1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-07 10:25:42 +02:00

core: use new key name in command /key and configuration file

Legacy keys are automatically converted to new names when loading configuration
file `weechat.conf`.

Examples:

  "ctrl-I" => "tab"
  "meta2-1;3A" => "meta-up"
  "meta2-Z" => "shift-tab"
  "meta-wmeta-meta2-A" => "meta-w,meta-up"
  "ctrl-Cb" => "ctrl-c,b"
This commit is contained in:
Sébastien Helleu
2023-02-22 21:18:22 +01:00
parent 5b5ccb236f
commit 1f5c791c37
22 changed files with 654 additions and 552 deletions
+9 -4
View File
@@ -660,15 +660,20 @@ genutzt: kbd:[Ctrl+↑] und kbd:[Ctrl+↓]).
Beispiele:
----
/key bind up /input history_global_previous
/key bind down /input history_global_next
----
// TRANSLATION MISSING
With WeeChat ≤ 3.8, you must use the raw key code (press kbd:[Alt+k] then key
to display its code):
----
/key bind meta2-A /input history_global_previous
/key bind meta2-B /input history_global_next
----
[NOTE]
Die Tasten "meta2-A" und "meta2-B" können im Hinblick auf das jeweils genutzte Terminal variieren.
Um die korrekten Tasten zu finden, sollte man mit kbd:[Alt+k] die gewünschte Tastenkombination einfangen.
[[mouse]]
== Mausunterstützung
+8 -4
View File
@@ -629,15 +629,19 @@ history are kbd:[Ctrl+↑] and kbd:[Ctrl+↓]).
Example:
----
/key bind up /input history_global_previous
/key bind down /input history_global_next
----
With WeeChat ≤ 3.8, you must use the raw key code (press kbd:[Alt+k] then key
to display its code):
----
/key bind meta2-A /input history_global_previous
/key bind meta2-B /input history_global_next
----
[NOTE]
Keys "meta2-A" and "meta2-B" may be different in your terminal. To find key
code press kbd:[Alt+k] then key.
[[mouse]]
== Mouse
+9 -4
View File
@@ -643,15 +643,20 @@ global son kbd:[Ctrl+↑] y kbd:[Ctrl+↓]).
Ejemplo:
----
/key bind up /input history_global_previous
/key bind down /input history_global_next
----
// TRANSLATION MISSING
With WeeChat ≤ 3.8, you must use the raw key code (press kbd:[Alt+k] then key
to display its code):
----
/key bind meta2-A /input history_global_previous
/key bind meta2-B /input history_global_next
----
[NOTE]
Las telcas "meta2-A" y "meta2-B" pueden ser diferentes en su terminal. Para encontrar el código
de la tecla pulse kbd:[Alt+k] y después la tecla.
[[mouse]]
== Ratón
+8 -4
View File
@@ -648,15 +648,19 @@ touches par défaut pour l'historique global sont kbd:[Ctrl+↑] et kbd:[Ctrl+
Exemple :
----
/key bind up /input history_global_previous
/key bind down /input history_global_next
----
Avec WeeChat ≤ 3.8, vous devez utiliser le code de touche brut (appuyez sur
kbd:[Alt+k] puis la touche pour afficher son code) :
----
/key bind meta2-A /input history_global_previous
/key bind meta2-B /input history_global_next
----
[NOTE]
Les touches "meta2-A" et "meta2-B" peuvent être différentes dans votre terminal.
Pour trouver le code de la touche appuyez sur kbd:[Alt+k] puis la touche.
[[mouse]]
== Souris
+9 -4
View File
@@ -693,15 +693,20 @@ sono kbd:[Ctrl+↑] e kbd:[Ctrl+↓]).
Esempio:
----
/key bind up /input history_global_previous
/key bind down /input history_global_next
----
// TRANSLATION MISSING
With WeeChat ≤ 3.8, you must use the raw key code (press kbd:[Alt+k] then key
to display its code):
----
/key bind meta2-A /input history_global_previous
/key bind meta2-B /input history_global_next
----
[NOTE]
I tasti "meta2-A" e "meta2-B" possono essere differenti nel proprio terminale.
Per trovare il codice tasto digitare kbd:[Alt+k] poi il tast.
[[mouse]]
== Mouse
+9 -4
View File
@@ -643,15 +643,20 @@ macOS のターミナル.app を使っている場合、設定メニューのキ
例:
----
/key bind up /input history_global_previous
/key bind down /input history_global_next
----
// TRANSLATION MISSING
With WeeChat ≤ 3.8, you must use the raw key code (press kbd:[Alt+k] then key
to display its code):
----
/key bind meta2-A /input history_global_previous
/key bind meta2-B /input history_global_next
----
[NOTE]
"meta2-A" と "meta2-B" キーは端末によって異なります。キーコードを見つけるには
kbd:[Alt+k] の後にキー を押してください。
[[mouse]]
== マウス
+9 -4
View File
@@ -632,15 +632,20 @@ globalnej historii przypisane są klawisze kbd:[Ctrl+↑] oraz kbd:[Ctrl+↓]).
Przykład:
----
/key bind up /input history_global_previous
/key bind down /input history_global_next
----
// TRANSLATION MISSING
With WeeChat ≤ 3.8, you must use the raw key code (press kbd:[Alt+k] then key
to display its code):
----
/key bind meta2-A /input history_global_previous
/key bind meta2-B /input history_global_next
----
[NOTE]
Klawisze "meta2-A" i "meta2-B" mogą być inne dla twojego terminala. W celu
znalezienia ich kodów wciśnij kbd:[Alt+k] następnie przycisk.
[[mouse]]
== Obsługa myszy
+9 -3
View File
@@ -559,14 +559,20 @@ UXTerm*metaSendsEscape: true
Пример:
----
/key bind up /input history_global_previous
/key bind down /input history_global_next
----
// TRANSLATION MISSING
With WeeChat ≤ 3.8, you must use the raw key code (press kbd:[Alt+k] then key
to display its code):
----
/key bind meta2-A /input history_global_previous
/key bind meta2-B /input history_global_next
----
[NOTE]
Тастери „meta2-A” и „meta2-B” могу бити различити на вашем терминалу. Да бисте пронашли кôд тастера, притисните kbd:[Alt+k] па онда тастер.
[[mouse]]
== Миш
+11 -63
View File
File diff suppressed because it is too large Load Diff
+6 -23
View File
@@ -1677,7 +1677,6 @@ completion_list_add_keys_codes_cb (const void *pointer, void *data,
{
int i;
struct t_gui_key *ptr_key;
char *expanded_name;
/* make C compiler happy */
(void) pointer;
@@ -1689,13 +1688,8 @@ 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_expand_legacy (ptr_key->key);
gui_completion_list_add (
completion,
(expanded_name) ? expanded_name : ptr_key->key,
0, WEECHAT_LIST_POS_SORT);
if (expanded_name)
free (expanded_name);
gui_completion_list_add (completion, ptr_key->key,
0, WEECHAT_LIST_POS_SORT);
}
}
@@ -1715,7 +1709,6 @@ completion_list_add_keys_codes_for_reset_cb (const void *pointer, void *data,
{
int i;
struct t_gui_key *ptr_key, *ptr_default_key;
char *expanded_name;
/* make C compiler happy */
(void) pointer;
@@ -1732,13 +1725,8 @@ 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_expand_legacy (ptr_key->key);
gui_completion_list_add (
completion,
(expanded_name) ? expanded_name : ptr_key->key,
0, WEECHAT_LIST_POS_SORT);
if (expanded_name)
free (expanded_name);
gui_completion_list_add (completion, ptr_key->key,
0, WEECHAT_LIST_POS_SORT);
}
}
@@ -1749,13 +1737,8 @@ 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_expand_legacy (ptr_default_key->key);
gui_completion_list_add (
completion,
(expanded_name) ? expanded_name : ptr_default_key->key,
0, WEECHAT_LIST_POS_SORT);
if (expanded_name)
free (expanded_name);
gui_completion_list_add (completion, ptr_default_key->key,
0, WEECHAT_LIST_POS_SORT);
}
}
}
+81 -12
View File
File diff suppressed because it is too large Load Diff
+2
View File
@@ -31,6 +31,8 @@ struct t_gui_buffer;
#define WEECHAT_CONFIG_NAME "weechat"
#define WEECHAT_CONFIG_PRIO_NAME "110000|weechat"
#define WEECHAT_CONFIG_VERSION 2
#define TAB_MAX_WIDTH 64
enum t_config_look_align_end_of_lines
File diff suppressed because it is too large Load Diff
+187 -157
View File
File diff suppressed because it is too large Load Diff
+4 -4
View File
@@ -54,8 +54,9 @@ enum t_gui_key_focus
struct t_gui_key
{
char *key; /* raw key (eg: \001w, \001[[1;3D) */
char *key_name; /* key name (eg: ctrl-w, meta-left) */
char *key; /* key name (eg: ctrl-w, meta-left) */
char **chunks; /* key chunks (split on comma) */
int chunks_count; /* number of chunks */
int area_type[2]; /* type of areas (for cursor/mouse) */
char *area_name[2]; /* name of areas (for cursor/mouse) */
char *area_key; /* key after area (after ":") */
@@ -90,8 +91,7 @@ extern time_t gui_key_last_activity_time;
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_expand_legacy (const char *key);
extern char *gui_key_legacy_expand (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);
+7 -15
View File
@@ -424,21 +424,13 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
int i;
char str_key[256];
char *default_keys[][2] = {
{ /* m-B */ "meta-B", "/buflist toggle" },
{ /* <f1> */ "meta-OP", "/bar scroll buflist * -100%" },
{ /* <f1> */ "meta2-11~", "/bar scroll buflist * -100%" },
{ /* <f2> */ "meta-OQ", "/bar scroll buflist * +100%" },
{ /* <f2> */ "meta2-12~", "/bar scroll buflist * +100%" },
{ /* c-<f1> */ "meta2-11^", "/bar scroll buflist * -100%" },
{ /* c-<f1> */ "meta2-1;5P", "/bar scroll buflist * -100%" },
{ /* c-<f2> */ "meta2-12^", "/bar scroll buflist * +100%" },
{ /* c-<f2> */ "meta2-1;5Q", "/bar scroll buflist * +100%" },
{ /* m-<f1> */ "meta-meta-OP", "/bar scroll buflist * b" },
{ /* m-<f1> */ "meta-meta2-11~", "/bar scroll buflist * b" },
{ /* m-<f1> */ "meta2-1;3P", "/bar scroll buflist * b" },
{ /* m-<f2> */ "meta-meta-OQ", "/bar scroll buflist * e" },
{ /* m-<f2> */ "meta-meta2-12~", "/bar scroll buflist * e" },
{ /* m-<f2> */ "meta2-1;3Q", "/bar scroll buflist * e" },
{ "meta-B", "/buflist toggle" },
{ "f1", "/bar scroll buflist * -100%" },
{ "f2", "/bar scroll buflist * +100%" },
{ "ctrl-f1", "/bar scroll buflist * -100%" },
{ "ctrl-f2", "/bar scroll buflist * +100%" },
{ "meta-f1", "/bar scroll buflist * b" },
{ "meta-f2", "/bar scroll buflist * e" },
{ NULL, NULL },
};
+15 -16
View File
@@ -1417,29 +1417,28 @@ void
fset_buffer_set_keys ()
{
char *keys[][2] = {
{ "meta2-A", "/fset -up" },
{ "meta2-B", "/fset -down" },
{ "meta-meta2-1~", "/fset -go 0" },
{ "meta-meta2-4~", "/fset -go end" },
{ "meta2-23~", "/fset -left" },
{ "meta2-24~", "/fset -right" },
{ "up", "/fset -up" },
{ "down", "/fset -down" },
{ "meta-home", "/fset -go 0" },
{ "meta-end", "/fset -go end" },
{ "f11", "/fset -left" },
{ "f12", "/fset -right" },
{ "meta-space", "/fset -toggle" },
{ "meta--", "/fset -add -1" },
{ "meta-+", "/fset -add 1" },
{ "meta-fmeta-r", "/fset -reset" },
{ "meta-fmeta-u", "/fset -unset" },
{ "meta-ctrl-j", "/fset -set" },
{ "meta-ctrl-m", "/fset -set" },
{ "meta-fmeta-n", "/fset -setnew" },
{ "meta-fmeta-a", "/fset -append" },
{ "meta-,", "/fset -mark" },
{ "meta2-a", "/fset -up; /fset -mark" },
{ "meta2-b", "/fset -mark; /fset -down" },
{ "meta-f,meta-r", "/fset -reset" },
{ "meta-f,meta-u", "/fset -unset" },
{ "meta-return", "/fset -set" },
{ "meta-f,meta-n", "/fset -setnew" },
{ "meta-f,meta-a", "/fset -append" },
{ "meta-comma", "/fset -mark" },
{ "shift-up", "/fset -up; /fset -mark" },
{ "shift-down", "/fset -mark; /fset -down" },
{ "ctrl-l", "/fset -refresh" },
{ "meta-p", "/mute /set fset.look.show_plugins_desc toggle" },
{ "meta-v", "/bar toggle " FSET_BAR_NAME },
{ "ctrl-x", "/fset -format" },
{ NULL, NULL },
{ NULL, NULL },
};
char str_key[64];
int i;
+2 -2
View File
@@ -257,8 +257,8 @@ relay_buffer_open ()
weechat_buffer_set (relay_buffer, "type", "free");
weechat_buffer_set (relay_buffer, "title", _("List of clients for relay"));
weechat_buffer_set (relay_buffer, "key_bind_meta2-A", "/relay up");
weechat_buffer_set (relay_buffer, "key_bind_meta2-B", "/relay down");
weechat_buffer_set (relay_buffer, "key_bind_up", "/relay up");
weechat_buffer_set (relay_buffer, "key_bind_down", "/relay down");
weechat_buffer_set (relay_buffer, "localvar_set_type", "relay");
}
}
+14 -12
View File
@@ -1090,21 +1090,23 @@ script_buffer_set_callbacks ()
void
script_buffer_set_keys ()
{
char *keys[][2] = { { "meta-A", "toggleautoload" },
{ "meta-l", "load" },
{ "meta-u", "unload" },
{ "meta-L", "reload" },
{ "meta-i", "install" },
{ "meta-r", "remove" },
{ "meta-h", "hold" },
{ "meta-v", "show" },
{ "meta-d", "showdiff" },
{ NULL, NULL } };
char *keys[][2] = {
{ "meta-A", "toggleautoload" },
{ "meta-l", "load" },
{ "meta-u", "unload" },
{ "meta-L", "reload" },
{ "meta-i", "install" },
{ "meta-r", "remove" },
{ "meta-h", "hold" },
{ "meta-v", "show" },
{ "meta-d", "showdiff" },
{ NULL, NULL },
};
char str_key[64], str_command[64];
int i;
weechat_buffer_set (script_buffer, "key_bind_meta2-A", "/script up");
weechat_buffer_set (script_buffer, "key_bind_meta2-B", "/script down");
weechat_buffer_set (script_buffer, "key_bind_up", "/script up");
weechat_buffer_set (script_buffer, "key_bind_down", "/script down");
for (i = 0; keys[i][0]; i++)
{
if (weechat_config_boolean (script_config_look_use_keys))
+2 -2
View File
@@ -358,8 +358,8 @@ xfer_buffer_open ()
weechat_buffer_set (xfer_buffer, "type", "free");
weechat_buffer_set (xfer_buffer, "title", _("Xfer list"));
weechat_buffer_set (xfer_buffer, "key_bind_meta2-A", "/xfer up");
weechat_buffer_set (xfer_buffer, "key_bind_meta2-B", "/xfer down");
weechat_buffer_set (xfer_buffer, "key_bind_up", "/xfer up");
weechat_buffer_set (xfer_buffer, "key_bind_down", "/xfer down");
weechat_buffer_set (xfer_buffer, "localvar_set_type", "xfer");
}
}
+2 -2
View File
@@ -462,11 +462,11 @@ TEST(GuiBuffer, NewProps)
STRCMP_EQUAL("value",
(const char *)hashtable_get (buffer->local_variables, "test"));
CHECK(buffer->keys);
STRCMP_EQUAL("\x01[y", buffer->keys->key);
STRCMP_EQUAL("meta-y", buffer->keys->key);
STRCMP_EQUAL("/test_y arg1 arg2", buffer->keys->command);
POINTERS_EQUAL(NULL, buffer->keys->prev_key);
CHECK(buffer->keys->next_key);
STRCMP_EQUAL("\x01[z", buffer->keys->next_key->key);
STRCMP_EQUAL("meta-z", buffer->keys->next_key->key);
STRCMP_EQUAL("/test_z arg1 arg2", buffer->keys->next_key->command);
POINTERS_EQUAL(buffer->keys, buffer->keys->next_key->prev_key);
POINTERS_EQUAL(NULL, buffer->keys->next_key->next_key);
File diff suppressed because it is too large Load Diff