summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2009-04-07 18:22:09 +0200
committerSebastien Helleu <flashcode@flashtux.org>2009-04-07 18:22:09 +0200
commit8ac00cdac6ba3a2caf9a7b282701e3bb22c988de (patch)
treec83a769c48b7682df37ac2ab61e2fda75d75527b
parent3aeb24cf1dcfead638b14a8c855128ee7f7f45c2 (diff)
downloadweechat-8ac00cdac6ba3a2caf9a7b282701e3bb22c988de.zip
Some improvements on key bindings
List of changes: - do not automatically create default keys if they do not exist, when reading weechat.conf (let user do that if needed) - add "/key missing": add missing keys using default keys (do not update or remove user keys), - key "meta-s" moved from irc/jabber plugins to core - improved output of /key (display number of keys)
-rw-r--r--doc/de/autogen/weechat_commands.xml3
-rw-r--r--doc/en/autogen/weechat_commands.xml3
-rw-r--r--doc/fr/autogen/weechat_commands.xml3
-rw-r--r--po/cs.po26
-rw-r--r--po/de.po27
-rw-r--r--po/es.po27
-rw-r--r--po/fr.po53
-rw-r--r--po/hu.po27
-rw-r--r--po/ru.po27
-rw-r--r--po/weechat.pot23
-rw-r--r--src/core/wee-command.c78
-rw-r--r--src/core/wee-config.c67
-rw-r--r--src/core/weechat.c2
-rw-r--r--src/gui/curses/gui-curses-keyboard.c219
-rw-r--r--src/gui/gui-keyboard.c43
-rw-r--r--src/gui/gui-keyboard.h5
-rw-r--r--src/plugins/irc/irc-buffer.c7
-rw-r--r--src/plugins/irc/irc-server.c3
-rw-r--r--src/plugins/jabber/jabber-buffer.c7
-rw-r--r--src/plugins/jabber/jabber-server.c3
20 files changed, 386 insertions, 267 deletions
diff --git a/doc/de/autogen/weechat_commands.xml b/doc/de/autogen/weechat_commands.xml
index b77278fbf..5e4e6be3c 100644
--- a/doc/de/autogen/weechat_commands.xml
+++ b/doc/de/autogen/weechat_commands.xml
@@ -150,13 +150,14 @@ functions for command line
Cette commande est utilisée par les associations de touches ou les extensions.
</programlisting>
-<command>/key [key [command [args]]] | [unbind key] | [reset -yes]</command>
+<command>/key [key [command [args]]] | [unbind key] | [reset -yes] | [missing]</command>
<programlisting>
belegen/freigeben von Tasten
key: display or bind this key to a command
unbind: unbind a key
reset: restore bindings to the default values and delete ALL personal bindings (use carefully!)
+ missing: add missing keys (using default bindings)
</programlisting>
<command>/layout [[save | apply | reset] [buffers | windows]]</command>
diff --git a/doc/en/autogen/weechat_commands.xml b/doc/en/autogen/weechat_commands.xml
index 4e47590a0..e9740ea33 100644
--- a/doc/en/autogen/weechat_commands.xml
+++ b/doc/en/autogen/weechat_commands.xml
@@ -150,13 +150,14 @@ functions for command line
Cette commande est utilisée par les associations de touches ou les extensions.
</programlisting>
-<command>/key [key [command [args]]] | [unbind key] | [reset -yes]</command>
+<command>/key [key [command [args]]] | [unbind key] | [reset -yes] | [missing]</command>
<programlisting>
bind/unbind keys
key: display or bind this key to a command
unbind: unbind a key
reset: restore bindings to the default values and delete ALL personal bindings (use carefully!)
+ missing: add missing keys (using default bindings)
</programlisting>
<command>/layout [[save | apply | reset] [buffers | windows]]</command>
diff --git a/doc/fr/autogen/weechat_commands.xml b/doc/fr/autogen/weechat_commands.xml
index 64bad46b7..e1f2412ed 100644
--- a/doc/fr/autogen/weechat_commands.xml
+++ b/doc/fr/autogen/weechat_commands.xml
@@ -149,13 +149,14 @@ fonctions pour la ligne de commande
Cette commande est utilisée par les associations de touches ou les extensions.
</programlisting>
-<command>/key [touche [commande [args]]] | [unbind touche] | [reset -yes]</command>
+<command>/key [touche [commande [args]]] | [unbind touche] | [reset -yes] | [missing]</command>
<programlisting>
associer/libérer des touches
touche: voir ou associer cette touche à une commande
unbind: supprimer l'association à une touche
reset: restaure les touches aux valeurs par défaut et supprime TOUTES les touches personnelles (utiliser avec précaution !)
+ missing: ajoute les touches manquantes (en utilisant les touches par défaut)
</programlisting>
<command>/layout [[save | apply | reset] [buffers | windows]]</command>
diff --git a/po/cs.po b/po/cs.po
index 629c3d2b5..1d74c0dc6 100644
--- a/po/cs.po
+++ b/po/cs.po
@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.2.7-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2009-04-05 14:08+0200\n"
+"POT-Creation-Date: 2009-04-07 18:12+0200\n"
"PO-Revision-Date: 2009-01-03 00:42+0100\n"
"Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -344,11 +344,12 @@ msgstr "%sNení dostupná žádná nápověda, \"%s\" není příkaz nebo volba"
msgid "Buffer command history:"
msgstr "Historie příkazů bufferu:"
-#, c-format
-msgid "New key binding: %s%s => %s%s"
-msgstr "Nová klávesová zkratka: %s%s => %s%s"
+#, fuzzy
+msgid "No key binding defined"
+msgstr "Žádné pole nejsou definovány"
-msgid "Key bindings:"
+#, fuzzy, c-format
+msgid "Key bindings (%d):"
msgstr "Klávesové zkratky:"
msgid "Default key bindings restored"
@@ -360,6 +361,12 @@ msgstr ""
"%sChyba: \"-yes\" argument je požadován pro reset kaláves (bezpečnostní "
"opatření)"
+#, fuzzy, c-format
+msgid "%d new key added"
+msgid_plural "%d new keys added"
+msgstr[0] "uživatel byl zablokován"
+msgstr[1] "uživatel byl zablokován"
+
#, c-format
msgid "Key \"%s\" unbound"
msgstr "Klávesa \"%s\" odpojena"
@@ -956,7 +963,7 @@ msgid "bind/unbind keys"
msgstr "napojit/odpojit klávesy"
#, fuzzy
-msgid "[key [command [args]]] | [unbind key] | [reset -yes]"
+msgid "[key [command [args]]] | [unbind key] | [reset -yes] | [missing]"
msgstr ""
"[klávesa [funkce/příkaz]] [unbind klávesa] [functions] [call funkce "
"[\"argumenty\"]] [reset -yes]"
@@ -966,7 +973,8 @@ msgid ""
" key: display or bind this key to a command\n"
" unbind: unbind a key\n"
" reset: restore bindings to the default values and delete ALL personal "
-"bindings (use carefully!)"
+"bindings (use carefully!)\n"
+" missing: add missing keys (using default bindings)"
msgstr ""
" klávesa: zobrazí nebo napojí klávesu na vnitřní funkci nebo příkaz "
"(začínající \"/\")\n"
@@ -2042,6 +2050,10 @@ msgstr "Nedostatek paměti pro nový řádek\n"
msgid "Error: not enough memory to add a buffer to hotlist"
msgstr "%s nemohu přidat buffer do hotlistu\n"
+#, c-format
+msgid "New key binding: %s%s => %s%s"
+msgstr "Nová klávesová zkratka: %s%s => %s%s"
+
#, fuzzy, c-format
msgid "Error: unable to bind key \"%s\""
msgstr "%s nemohu napojit kalávesu \"%s\"\n"
diff --git a/po/de.po b/po/de.po
index e7220882e..97a95a91f 100644
--- a/po/de.po
+++ b/po/de.po
@@ -9,7 +9,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.2.7-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2009-04-05 14:08+0200\n"
+"POT-Creation-Date: 2009-04-07 18:12+0200\n"
"PO-Revision-Date: 2009-01-03 00:42+0100\n"
"Last-Translator: Thomas Schuetz <i18n@internet-villa.de>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -373,12 +373,12 @@ msgstr "Keine Hilfe verfügbar, der Befehl \"%s\" ist unbekannt\n"
msgid "Buffer command history:"
msgstr "zeigt Befehlsverlauf des Puffers"
-#, fuzzy, c-format
-msgid "New key binding: %s%s => %s%s"
-msgstr "Neue Tastenbelegung: %s"
-
#, fuzzy
-msgid "Key bindings:"
+msgid "No key binding defined"
+msgstr "Keine Aliases definiert.\n"
+
+#, fuzzy, c-format
+msgid "Key bindings (%d):"
msgstr "Tastenbelegungen:\n"
#, fuzzy
@@ -392,6 +392,12 @@ msgstr ""
"notwendig\n"
#, fuzzy, c-format
+msgid "%d new key added"
+msgid_plural "%d new keys added"
+msgstr[0] "Keine /ignore-Regeln definiert.\n"
+msgstr[1] "Keine /ignore-Regeln definiert.\n"
+
+#, fuzzy, c-format
msgid "Key \"%s\" unbound"
msgstr "Tastenbelegung \"%s\" gelöscht\n"
@@ -982,7 +988,7 @@ msgid "bind/unbind keys"
msgstr "belegen/freigeben von Tasten"
#, fuzzy
-msgid "[key [command [args]]] | [unbind key] | [reset -yes]"
+msgid "[key [command [args]]] | [unbind key] | [reset -yes] | [missing]"
msgstr ""
"[Taste [Funktion/Befehl]] [unbind Taste] [functions] [call Funktion "
"[\"Argumente\"]] [reset -yes] "
@@ -992,7 +998,8 @@ msgid ""
" key: display or bind this key to a command\n"
" unbind: unbind a key\n"
" reset: restore bindings to the default values and delete ALL personal "
-"bindings (use carefully!)"
+"bindings (use carefully!)\n"
+" missing: add missing keys (using default bindings)"
msgstr ""
" Taste: diese Taste anzeigen oder mit einer internen Funktion oder "
"einem Befehl, beginnend mit \"/\", belegen\n"
@@ -2053,6 +2060,10 @@ msgid "Error: not enough memory to add a buffer to hotlist"
msgstr "%s Puffer kann nicht zur Hotlist hinzugefügt werden\n"
#, fuzzy, c-format
+msgid "New key binding: %s%s => %s%s"
+msgstr "Neue Tastenbelegung: %s"
+
+#, fuzzy, c-format
msgid "Error: unable to bind key \"%s\""
msgstr "%s kann die Taste \"%s\" nicht zuordnen\n"
diff --git a/po/es.po b/po/es.po
index 981250738..1dac85e87 100644
--- a/po/es.po
+++ b/po/es.po
@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.2.7-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2009-04-05 14:08+0200\n"
+"POT-Creation-Date: 2009-04-07 18:12+0200\n"
"PO-Revision-Date: 2009-01-03 00:42+0100\n"
"Last-Translator: Roberto González Cardenete <robert.glez@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -369,12 +369,12 @@ msgstr "No hay ayuda disponible, el comando \"%s\" es desconocido\n"
msgid "Buffer command history:"
msgstr "mostrar historial de comandos de búfer"
-#, fuzzy, c-format
-msgid "New key binding: %s%s => %s%s"
-msgstr "Nueva anclaje de clave: %s"
-
#, fuzzy
-msgid "Key bindings:"
+msgid "No key binding defined"
+msgstr "Ningún alias definido.\n"
+
+#, fuzzy, c-format
+msgid "Key bindings (%d):"
msgstr "Anclajes de clave:\n"
#, fuzzy
@@ -388,6 +388,12 @@ msgstr ""
"seguridad)\n"
#, fuzzy, c-format
+msgid "%d new key added"
+msgid_plural "%d new keys added"
+msgstr[0] "Sin ignores definidos.\n"
+msgstr[1] "Sin ignores definidos.\n"
+
+#, fuzzy, c-format
msgid "Key \"%s\" unbound"
msgstr "Clave \"%s\" desatada\n"
@@ -978,7 +984,7 @@ msgid "bind/unbind keys"
msgstr "atar/desatar claves"
#, fuzzy
-msgid "[key [command [args]]] | [unbind key] | [reset -yes]"
+msgid "[key [command [args]]] | [unbind key] | [reset -yes] | [missing]"
msgstr "[clave función/comando] [desatar clave] [funciones] [reset -yes]"
#, fuzzy
@@ -986,7 +992,8 @@ msgid ""
" key: display or bind this key to a command\n"
" unbind: unbind a key\n"
" reset: restore bindings to the default values and delete ALL personal "
-"bindings (use carefully!)"
+"bindings (use carefully!)\n"
+" missing: add missing keys (using default bindings)"
msgstr ""
" clave: ata esta clave a una función interna o a un comando (comenzando "
"por \"/ \")\n"
@@ -2031,6 +2038,10 @@ msgid "Error: not enough memory to add a buffer to hotlist"
msgstr "%s no es posible añadir un búfer a la lista caliente (hotlist)\n"
#, fuzzy, c-format
+msgid "New key binding: %s%s => %s%s"
+msgstr "Nueva anclaje de clave: %s"
+
+#, fuzzy, c-format
msgid "Error: unable to bind key \"%s\""
msgstr "%s No ha sido posible atar la clave \"%s\"\n"
diff --git a/po/fr.po b/po/fr.po
index 6f536a48b..7ec767710 100644
--- a/po/fr.po
+++ b/po/fr.po
@@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.2.7-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2009-04-05 14:08+0200\n"
-"PO-Revision-Date: 2009-04-05 14:09+0200\n"
+"POT-Creation-Date: 2009-04-07 18:12+0200\n"
+"PO-Revision-Date: 2009-04-07 18:01+0200\n"
"Last-Translator: FlashCode <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"MIME-Version: 1.0\n"
@@ -347,12 +347,12 @@ msgstr "%sPas d'aide disponible, \"%s\" n'est pas une commande ou une option"
msgid "Buffer command history:"
msgstr "Historique des commandes du tampon:"
-#, c-format
-msgid "New key binding: %s%s => %s%s"
-msgstr "Nouvelle touche: %s%s => %s%s"
+msgid "No key binding defined"
+msgstr "Pas d'association de touche définie"
-msgid "Key bindings:"
-msgstr "Associations de touches:"
+#, c-format
+msgid "Key bindings (%d):"
+msgstr "Associations de touches (%d):"
msgid "Default key bindings restored"
msgstr "Touches par défaut restaurées"
@@ -364,6 +364,12 @@ msgstr ""
"touches (raison de sécurité)"
#, c-format
+msgid "%d new key added"
+msgid_plural "%d new keys added"
+msgstr[0] "%d nouvelle touche ajoutée"
+msgstr[1] "%d nouvelles touches ajoutées"
+
+#, c-format
msgid "Key \"%s\" unbound"
msgstr "Touche \"%s\" supprimée"
@@ -1023,19 +1029,23 @@ msgstr ""
msgid "bind/unbind keys"
msgstr "associer/libérer des touches"
-msgid "[key [command [args]]] | [unbind key] | [reset -yes]"
-msgstr "[touche [commande [args]]] | [unbind touche] | [reset -yes]"
+msgid "[key [command [args]]] | [unbind key] | [reset -yes] | [missing]"
+msgstr ""
+"[touche [commande [args]]] | [unbind touche] | [reset -yes] | [missing]"
msgid ""
" key: display or bind this key to a command\n"
" unbind: unbind a key\n"
" reset: restore bindings to the default values and delete ALL personal "
-"bindings (use carefully!)"
+"bindings (use carefully!)\n"
+" missing: add missing keys (using default bindings)"
msgstr ""
" touche: voir ou associer cette touche à une commande\n"
" unbind: supprimer l'association à une touche\n"
" reset: restaure les touches aux valeurs par défaut et supprime TOUTES "
-"les touches personnelles (utiliser avec précaution !)"
+"les touches personnelles (utiliser avec précaution !)\n"
+" missing: ajoute les touches manquantes (en utilisant les touches par "
+"défaut)"
msgid "save/apply/reset layout for buffers and windows"
msgstr "sauve/applique/réinitialise la disposition des tampons et fenêtres"
@@ -2131,6 +2141,10 @@ msgid "Error: not enough memory to add a buffer to hotlist"
msgstr "Erreur: impossible d'ajouter le tampon à la liste des tampons actifs"
#, c-format
+msgid "New key binding: %s%s => %s%s"
+msgstr "Nouvelle touche: %s%s => %s%s"
+
+#, c-format
msgid "Error: unable to bind key \"%s\""
msgstr "Erreur: impossible de créer la touche \"%s\""
@@ -5705,20 +5719,3 @@ msgstr "%s%s: impossible de positionner l'option \"nonblock\" pour la socket"
#, c-format
msgid "%s%s: timeout for \"%s\" with %s"
msgstr "%s%s: délai d'attente dépassé pour \"%s\" avec %s"
-
-#~ msgid ""
-#~ "smart completion for nicks (completes first with last speakers, "
-#~ "highlights or both)"
-#~ msgstr ""
-#~ "complétion intelligente pour les pseudos (complète d'abord avec les "
-#~ "personnes qui ont parlé récemment)"
-
-#~ msgid ""
-#~ "partially complete nicks (stop when many nicks found begin with same "
-#~ "letters)"
-#~ msgstr ""
-#~ "complète partiellement les pseudos (stoppe quand plusieurs pseudos "
-#~ "trouvés commencent par les mêmes lettres)"
-
-#~ msgid "[action [args] | number | [[server] [channel]]]"
-#~ msgstr "[action [args] | nombre | [[serveur] [canal]]]"
diff --git a/po/hu.po b/po/hu.po
index 52682413a..55aac80b4 100644
--- a/po/hu.po
+++ b/po/hu.po
@@ -12,7 +12,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.2.7-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2009-04-05 14:08+0200\n"
+"POT-Creation-Date: 2009-04-07 18:12+0200\n"
"PO-Revision-Date: 2009-01-03 00:42+0100\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -374,12 +374,12 @@ msgstr "Nem érhető el segítség, a \"%s\" ismeretlen parancs\n"
msgid "Buffer command history:"
msgstr "a pufferben kiadott parancsok előzményének mutatása"
-#, fuzzy, c-format
-msgid "New key binding: %s%s => %s%s"
-msgstr "Új billentyűparancs: %s"
-
#, fuzzy
-msgid "Key bindings:"
+msgid "No key binding defined"
+msgstr "Nincs aliasz definiálva.\n"
+
+#, fuzzy, c-format
+msgid "Key bindings (%d):"
msgstr "Billentyűparancsok:\n"
#, fuzzy
@@ -393,6 +393,12 @@ msgstr ""
"visszaállításához (biztonsági okokból)\n"
#, fuzzy, c-format
+msgid "%d new key added"
+msgid_plural "%d new keys added"
+msgstr[0] "Nincs mellőzés megadva.\n"
+msgstr[1] "Nincs mellőzés megadva.\n"
+
+#, fuzzy, c-format
msgid "Key \"%s\" unbound"
msgstr "A(z) \"%s\" billentyűparancs visszavonva\n"
@@ -998,7 +1004,7 @@ msgid "bind/unbind keys"
msgstr "billentyűk hozzárendelése/hozzárendelés eltávolítása"
#, fuzzy
-msgid "[key [command [args]]] | [unbind key] | [reset -yes]"
+msgid "[key [command [args]]] | [unbind key] | [reset -yes] | [missing]"
msgstr ""
"[billentyű [funkció/parancs]] [unbind billentyű] [funkciók] [call funkció "
"[\"paraméterek\"]] [reset -yes]"
@@ -1008,7 +1014,8 @@ msgid ""
" key: display or bind this key to a command\n"
" unbind: unbind a key\n"
" reset: restore bindings to the default values and delete ALL personal "
-"bindings (use carefully!)"
+"bindings (use carefully!)\n"
+" missing: add missing keys (using default bindings)"
msgstr ""
"billentyű: billentyű hozzárendelése valamely belső funkcióhoz vagy \"/\" "
"jellel kezdődő parancshoz\n"
@@ -2061,6 +2068,10 @@ msgid "Error: not enough memory to add a buffer to hotlist"
msgstr "%s nincs elég memória az ignore elkészítéséhez\n"
#, fuzzy, c-format
+msgid "New key binding: %s%s => %s%s"
+msgstr "Új billentyűparancs: %s"
+
+#, fuzzy, c-format
msgid "Error: unable to bind key \"%s\""
msgstr "%s nem sikerült a(z) \"%s\" billentyűt hozzárendelni\n"
diff --git a/po/ru.po b/po/ru.po
index d3abdf970..ee816cbb4 100644
--- a/po/ru.po
+++ b/po/ru.po
@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.2.7-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2009-04-05 14:08+0200\n"
+"POT-Creation-Date: 2009-04-07 18:12+0200\n"
"PO-Revision-Date: 2009-01-03 00:42+0100\n"
"Last-Translator: Pavel Shevchuk <stlwrt@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -370,12 +370,12 @@ msgstr "Справка недоступна, \"%s\" не является ком
msgid "Buffer command history:"
msgstr "показать историю буфера команд"
-#, fuzzy, c-format
-msgid "New key binding: %s%s => %s%s"
-msgstr "Новая комбинация клавиш: %s"
-
#, fuzzy
-msgid "Key bindings:"
+msgid "No key binding defined"
+msgstr "Сокращения не заданы.\n"
+
+#, fuzzy, c-format
+msgid "Key bindings (%d):"
msgstr "Комбинации клавиш:\n"
#, fuzzy
@@ -388,6 +388,12 @@ msgstr ""
"%s аргумент \"-yes\" необходим для сброса ключей (в целях безопасности)\n"
#, fuzzy, c-format
+msgid "%d new key added"
+msgid_plural "%d new keys added"
+msgstr[0] "Игнорирования не заданы.\n"
+msgstr[1] "Игнорирования не заданы.\n"
+
+#, fuzzy, c-format
msgid "Key \"%s\" unbound"
msgstr "Клавиша \"%s\" не привязана\n"
@@ -993,7 +999,7 @@ msgid "bind/unbind keys"
msgstr "установить/снять клавиши"
#, fuzzy
-msgid "[key [command [args]]] | [unbind key] | [reset -yes]"
+msgid "[key [command [args]]] | [unbind key] | [reset -yes] | [missing]"
msgstr ""
"[клавиша [функция/команда]] [unbind клавиша] [функции] [call функция "
"[\"аргументы\"]] [reset -yes]"
@@ -1003,7 +1009,8 @@ msgid ""
" key: display or bind this key to a command\n"
" unbind: unbind a key\n"
" reset: restore bindings to the default values and delete ALL personal "
-"bindings (use carefully!)"
+"bindings (use carefully!)\n"
+" missing: add missing keys (using default bindings)"
msgstr ""
" клавиша: отобразить или назначить этой клавише функцию или команду "
"(начинающуюся на \"/\")\n"
@@ -2066,6 +2073,10 @@ msgid "Error: not enough memory to add a buffer to hotlist"
msgstr "%s не могу добавить буфер в хотлист\n"
#, fuzzy, c-format
+msgid "New key binding: %s%s => %s%s"
+msgstr "Новая комбинация клавиш: %s"
+
+#, fuzzy, c-format
msgid "Error: unable to bind key \"%s\""
msgstr "%s не могу установить клавишу \"%s\"\n"
diff --git a/po/weechat.pot b/po/weechat.pot
index 9ef47ccdb..c89054c38 100644
--- a/po/weechat.pot
+++ b/po/weechat.pot
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2009-04-05 14:08+0200\n"
+"POT-Creation-Date: 2009-04-07 18:12+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -326,11 +326,11 @@ msgstr ""
msgid "Buffer command history:"
msgstr ""
-#, c-format
-msgid "New key binding: %s%s => %s%s"
+msgid "No key binding defined"
msgstr ""
-msgid "Key bindings:"
+#, c-format
+msgid "Key bindings (%d):"
msgstr ""
msgid "Default key bindings restored"
@@ -341,6 +341,12 @@ msgid "%sError: \"-yes\" argument is required for keys reset (security reason)"
msgstr ""
#, c-format
+msgid "%d new key added"
+msgid_plural "%d new keys added"
+msgstr[0] ""
+msgstr[1] ""
+
+#, c-format
msgid "Key \"%s\" unbound"
msgstr ""
@@ -864,14 +870,15 @@ msgstr ""
msgid "bind/unbind keys"
msgstr ""
-msgid "[key [command [args]]] | [unbind key] | [reset -yes]"
+msgid "[key [command [args]]] | [unbind key] | [reset -yes] | [missing]"
msgstr ""
msgid ""
" key: display or bind this key to a command\n"
" unbind: unbind a key\n"
" reset: restore bindings to the default values and delete ALL personal "
-"bindings (use carefully!)"
+"bindings (use carefully!)\n"
+" missing: add missing keys (using default bindings)"
msgstr ""
msgid "save/apply/reset layout for buffers and windows"
@@ -1754,6 +1761,10 @@ msgid "Error: not enough memory to add a buffer to hotlist"
msgstr ""
#, c-format
+msgid "New key binding: %s%s => %s%s"
+msgstr ""
+
+#, c-format
msgid "Error: unable to bind key \"%s\""
msgstr ""
diff --git a/src/core/wee-command.c b/src/core/wee-command.c
index f9b3a6092..cd11607c3 100644
--- a/src/core/wee-command.c
+++ b/src/core/wee-command.c
@@ -1705,28 +1705,16 @@ command_input (void *data, struct t_gui_buffer *buffer,
*/
void
-command_key_display (struct t_gui_key *key, int new_key)
+command_key_display (struct t_gui_key *key)
{
char *expanded_name;
-
+
expanded_name = gui_keyboard_get_expanded_name (key->key);
- if (new_key)
- {
- gui_chat_printf (NULL,
- _("New key binding: %s%s => %s%s"),
- (expanded_name) ? expanded_name : key->key,
- GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS),
- GUI_COLOR(GUI_COLOR_CHAT),
- key->command);
- }
- else
- {
- gui_chat_printf (NULL, " %20s%s => %s%s",
- (expanded_name) ? expanded_name : key->key,
- GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS),
- GUI_COLOR(GUI_COLOR_CHAT),
- key->command);
- }
+ gui_chat_printf (NULL, " %20s%s => %s%s",
+ (expanded_name) ? expanded_name : key->key,
+ GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS),
+ GUI_COLOR(GUI_COLOR_CHAT),
+ key->command);
if (expanded_name)
free (expanded_name);
}
@@ -1741,6 +1729,7 @@ command_key (void *data, struct t_gui_buffer *buffer,
{
char *internal_code;
struct t_gui_key *ptr_key;
+ int old_keys_count, keys_added;
/* make C compiler happy */
(void) data;
@@ -1749,11 +1738,17 @@ command_key (void *data, struct t_gui_buffer *buffer,
/* display all key bindings */
if (argc == 1)
{
- gui_chat_printf (NULL, "");
- gui_chat_printf (NULL, _("Key bindings:"));
- for (ptr_key = gui_keys; ptr_key; ptr_key = ptr_key->next_key)
+ if (gui_keys_count == 0)
+ gui_chat_printf (NULL, _("No key binding defined"));
+ else
{
- command_key_display (ptr_key, 0);
+ gui_chat_printf (NULL, "");
+ gui_chat_printf (NULL, _("Key bindings (%d):"),
+ gui_keys_count);
+ for (ptr_key = gui_keys; ptr_key; ptr_key = ptr_key->next_key)
+ {
+ command_key_display (ptr_key);
+ }
}
return WEECHAT_RC_OK;
}
@@ -1764,7 +1759,7 @@ command_key (void *data, struct t_gui_buffer *buffer,
if ((argc >= 3) && (string_strcasecmp (argv[2], "-yes") == 0))
{
gui_keyboard_free_all (&gui_keys, &last_gui_key);
- gui_keyboard_init ();
+ gui_keyboard_default_bindings ();
gui_chat_printf (NULL,
_("Default key bindings restored"));
}
@@ -1779,6 +1774,21 @@ command_key (void *data, struct t_gui_buffer *buffer,
return WEECHAT_RC_OK;
}
+ /* add missing keys */
+ if (string_strcasecmp (argv[1], "missing") == 0)
+ {
+ old_keys_count = gui_keys_count;
+ gui_keyboard_verbose = 1;
+ gui_keyboard_default_bindings ();
+ gui_keyboard_verbose = 0;
+ keys_added = (gui_keys_count > old_keys_count) ?
+ gui_keys_count - old_keys_count : 0;
+ gui_chat_printf (NULL,
+ NG_("%d new key added", "%d new keys added", keys_added),
+ keys_added);
+ return WEECHAT_RC_OK;
+ }
+
/* unbind a key */
if (string_strcasecmp (argv[1], "unbind") == 0)
{
@@ -1813,7 +1823,7 @@ command_key (void *data, struct t_gui_buffer *buffer,
{
gui_chat_printf (NULL, "");
gui_chat_printf (NULL, _("Key:"));
- command_key_display (ptr_key, 0);
+ command_key_display (ptr_key);
}
else
{
@@ -1824,14 +1834,12 @@ command_key (void *data, struct t_gui_buffer *buffer,
free (internal_code);
return WEECHAT_RC_OK;
}
-
+
/* bind new key */
+ gui_keyboard_verbose = 1;
ptr_key = gui_keyboard_bind (NULL, argv[1], argv_eol[2]);
- if (ptr_key)
- {
- command_key_display (ptr_key, 1);
- }
- else
+ gui_keyboard_verbose = 0;
+ if (!ptr_key)
{
gui_chat_printf (NULL,
_("%sError: unable to bind key \"%s\""),
@@ -3783,12 +3791,14 @@ command_init ()
&command_input, NULL);
hook_command (NULL, "key",
N_("bind/unbind keys"),
- N_("[key [command [args]]] | [unbind key] | [reset -yes]"),
+ N_("[key [command [args]]] | [unbind key] | [reset -yes] | "
+ "[missing]"),
N_(" key: display or bind this key to a command\n"
" unbind: unbind a key\n"
" reset: restore bindings to the default values and "
- "delete ALL personal bindings (use carefully!)"),
- "unbind|reset",
+ "delete ALL personal bindings (use carefully!)\n"
+ " missing: add missing keys (using default bindings)"),
+ "unbind|reset|missing",
&command_key, NULL);
hook_command (NULL, "layout",
N_("save/apply/reset layout for buffers and windows"),
diff --git a/src/core/wee-config.c b/src/core/wee-config.c
index 38c549663..5841516f0 100644
--- a/src/core/wee-config.c
+++ b/src/core/wee-config.c
@@ -395,15 +395,15 @@ config_change_day_change (void *data, struct t_config_option *option)
}
/*
- * config_weechat_reload: reload WeeChat configuration file
- * return one of these values:
- * WEECHAT_CONFIG_READ_OK
- * WEECHAT_CONFIG_READ_MEMORY_ERROR
- * WEECHAT_CONFIG_READ_FILE_NOT_FOUND
+ * config_weechat_reload_cb: reload WeeChat configuration file
+ * return one of these values:
+ * WEECHAT_CONFIG_READ_OK
+ * WEECHAT_CONFIG_READ_MEMORY_ERROR
+ * WEECHAT_CONFIG_READ_FILE_NOT_FOUND
*/
int
-config_weechat_reload (void *data, struct t_config_file *config_file)
+config_weechat_reload_cb (void *data, struct t_config_file *config_file)
{
int rc;
@@ -412,7 +412,6 @@ config_weechat_reload (void *data, struct t_config_file *config_file)
/* remove all keys */
gui_keyboard_free_all (&gui_keys, &last_gui_key);
- gui_keyboard_default_bindings ();
/* remove all proxies */
proxy_free_all ();
@@ -434,6 +433,9 @@ config_weechat_reload (void *data, struct t_config_file *config_file)
proxy_use_temp_proxies ();
gui_bar_use_temp_bars ();
gui_bar_create_default ();
+ /* if no key was found config file, then we use default bindings */
+ if (!gui_keys)
+ gui_keyboard_default_bindings ();
}
return rc;
@@ -476,12 +478,12 @@ config_weechat_debug_set_all ()
}
/*
- * config_weechat_debug_change: called when a debug option is changed
+ * config_weechat_debug_change_cb: called when a debug option is changed
*/
void
-config_weechat_debug_change (void *data,
- struct t_config_option *option)
+config_weechat_debug_change_cb (void *data,
+ struct t_config_option *option)
{
/* make C compiler happy */
(void) data;
@@ -491,15 +493,15 @@ config_weechat_debug_change (void *data,
}
/*
- * config_weechat_debug_create_option: create option in "debug" section
+ * config_weechat_debug_create_option_cb: create option in "debug" section
*/
int
-config_weechat_debug_create_option (void *data,
- struct t_config_file *config_file,
- struct t_config_section *section,
- const char *option_name,
- const char *value)
+config_weechat_debug_create_option_cb (void *data,
+ struct t_config_file *config_file,
+ struct t_config_section *section,
+ const char *option_name,
+ const char *value)
{
struct t_config_option *ptr_option;
int rc;
@@ -532,7 +534,7 @@ config_weechat_debug_create_option (void *data,
option_name, "integer",
_("debug level for plugin (\"core\" for WeeChat core)"),
NULL, 0, 32, "0", value, 0, NULL, NULL,
- &config_weechat_debug_change, NULL,
+ &config_weechat_debug_change_cb, NULL,
NULL, NULL);
rc = (ptr_option) ?
WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE : WEECHAT_CONFIG_OPTION_SET_ERROR;
@@ -549,14 +551,14 @@ config_weechat_debug_create_option (void *data,
}
/*
- * config_weechat_debug_delete_option: delete option in "debug" section
+ * config_weechat_debug_delete_option_cb: delete option in "debug" section
*/
int
-config_weechat_debug_delete_option (void *data,
- struct t_config_file *config_file,
- struct t_config_section *section,
- struct t_config_option *option)
+config_weechat_debug_delete_option_cb (void *data,
+ struct t_config_file *config_file,
+ struct t_config_section *section,
+ struct t_config_option *option)
{
/* make C compiler happy */
(void) data;
@@ -577,11 +579,11 @@ config_weechat_debug_delete_option (void *data,
int
config_weechat_debug_set (const char *plugin_name, const char *value)
{
- return config_weechat_debug_create_option (NULL,
- weechat_config_file,
- weechat_config_section_debug,
- plugin_name,
- value);
+ return config_weechat_debug_create_option_cb (NULL,
+ weechat_config_file,
+ weechat_config_section_debug,
+ plugin_name,
+ value);
}
/*
@@ -994,7 +996,7 @@ config_weechat_init_options ()
struct t_config_section *ptr_section;
weechat_config_file = config_file_new (NULL, WEECHAT_CONFIG_NAME,
- &config_weechat_reload, NULL);
+ &config_weechat_reload_cb, NULL);
if (!weechat_config_file)
return 0;
@@ -1003,8 +1005,8 @@ config_weechat_init_options ()
1, 1,
NULL, NULL, NULL, NULL,
NULL, NULL,
- &config_weechat_debug_create_option, NULL,
- &config_weechat_debug_delete_option, NULL);
+ &config_weechat_debug_create_option_cb, NULL,
+ &config_weechat_debug_delete_option_cb, NULL);
if (!ptr_section)
{
config_file_free (weechat_config_file);
@@ -1863,8 +1865,11 @@ config_weechat_read ()
proxy_use_temp_proxies ();
gui_bar_use_temp_bars ();
gui_bar_create_default ();
+ /* if no key was found config file, then we use default bindings */
+ if (!gui_keys)
+ gui_keyboard_default_bindings ();
}
-
+
if (rc != WEECHAT_CONFIG_READ_OK)
{
gui_chat_printf (NULL,
diff --git a/src/core/weechat.c b/src/core/weechat.c
index fb4b48092..236f5c3db 100644
--- a/src/core/weechat.c
+++ b/src/core/weechat.c
@@ -388,7 +388,7 @@ main (int argc, char *argv[])
gui_main_pre_init (&argc, &argv); /* pre-initiliaze interface */
weechat_init_vars (); /* initialize some variables */
command_init (); /* initialize WeeChat commands */
- gui_keyboard_init (); /* init keyb. (default key bindings)*/
+ gui_keyboard_init (); /* init keyboard */
if (!config_weechat_init ()) /* init options with default values */
exit (EXIT_FAILURE);
weechat_parse_args (argc, argv); /* parse command line args */
diff --git a/src/gui/curses/gui-curses-keyboard.c b/src/gui/curses/gui-curses-keyboard.c
index 269926f41..e0d187502 100644
--- a/src/gui/curses/gui-curses-keyboard.c
+++ b/src/gui/curses/gui-curses-keyboard.c
@@ -45,6 +45,28 @@
/*
+ * gui_keyboard_default_bind: create key bind, only if it does not exist yet
+ */
+
+void
+gui_keyboard_default_bind (const char *key, const char *command)
+{
+ struct t_gui_key *ptr_key;
+ char *internal_code;
+
+ internal_code = gui_keyboard_get_internal_code (key);
+
+ ptr_key = gui_keyboard_search (NULL, (internal_code) ? internal_code : key);
+ if (!ptr_key)
+ {
+ gui_keyboard_new (NULL, key, command);
+ }
+
+ if (internal_code)
+ free (internal_code);
+}
+
+/*
* gui_keyboard_default_bindings: create default key bindings
*/
@@ -54,110 +76,111 @@ gui_keyboard_default_bindings ()
int i;
char key_str[32], command[32];
- gui_keyboard_bind (NULL, /* RC */ "ctrl-M", "/input return");
- gui_keyboard_bind (NULL, /* RC */ "ctrl-J", "/input return");
- gui_keyboard_bind (NULL, /* tab */ "ctrl-I", "/input complete_next");
- gui_keyboard_bind (NULL, /* s-tab */ "meta2-Z", "/input complete_previous");
- gui_keyboard_bind (NULL, /* ^R */ "ctrl-R", "/input search_text");
- gui_keyboard_bind (NULL, /* basckpace */ "ctrl-H", "/input delete_previous_char");
- gui_keyboard_bind (NULL, /* basckpace */ "ctrl-?", "/input delete_previous_char");
- gui_keyboard_bind (NULL, /* del */ "meta2-3~", "/input delete_next_char");
- gui_keyboard_bind (NULL, /* ^D */ "ctrl-D", "/input delete_next_char");
- gui_keyboard_bind (NULL, /* ^W */ "ctrl-W", "/input delete_previous_word");
- gui_keyboard_bind (NULL, /* m-d */ "meta-d", "/input delete_next_word");
- gui_keyboard_bind (NULL, /* ^K */ "ctrl-K", "/input delete_end_of_line");
- gui_keyboard_bind (NULL, /* m-r */ "meta-r", "/input delete_line");
- gui_keyboard_bind (NULL, /* ^T */ "ctrl-T", "/input transpose_chars");
- gui_keyboard_bind (NULL, /* ^U */ "ctrl-U", "/input delete_beginning_of_line");
- gui_keyboard_bind (NULL, /* ^Y */ "ctrl-Y", "/input clipboard_paste");
- gui_keyboard_bind (NULL, /* home */ "meta2-1~", "/input move_beginning_of_line");
- gui_keyboard_bind (NULL, /* home */ "meta2-H", "/input move_beginning_of_line");
- gui_keyboard_bind (NULL, /* home */ "meta2-7~", "/input move_beginning_of_line");
- gui_keyboard_bind (NULL, /* ^A */ "ctrl-A", "/input move_beginning_of_line");
- gui_keyboard_bind (NULL, /* end */ "meta2-4~", "/input move_end_of_line");
- gui_keyboard_bind (NULL, /* end */ "meta2-F", "/input move_end_of_line");
- gui_keyboard_bind (NULL, /* end */ "meta2-8~", "/input move_end_of_line");
- gui_keyboard_bind (NULL, /* ^E */ "ctrl-E", "/input move_end_of_line");
- gui_keyboard_bind (NULL, /* left */ "meta2-D", "/input move_previous_char");
- gui_keyboard_bind (NULL, /* ^B */ "ctrl-B", "/input move_previous_char");
- gui_keyboard_bind (NULL, /* right */ "meta2-C", "/input move_next_char");
- gui_keyboard_bind (NULL, /* ^F */ "ctrl-F", "/input move_next_char");
- gui_keyboard_bind (NULL, /* m-b */ "meta-b", "/input move_previous_word");
- gui_keyboard_bind (NULL, /* ^left */ "meta-Od", "/input move_previous_word");
- gui_keyboard_bind (NULL, /* m-f */ "meta-f", "/input move_next_word");
- gui_keyboard_bind (NULL, /* ^right */ "meta-Oc", "/input move_next_word");
- gui_keyboard_bind (NULL, /* up */ "meta2-A", "/input history_previous");
- gui_keyboard_bind (NULL, /* down */ "meta2-B", "/input history_next");
- gui_keyboard_bind (NULL, /* ^up */ "meta-Oa", "/input history_global_previous");
- gui_keyboard_bind (NULL, /* ^down */ "meta-Ob", "/input history_global_next");
- gui_keyboard_bind (NULL, /* m-a */ "meta-a", "/input jump_smart");
- gui_keyboard_bind (NULL, /* m-j,m-l */ "meta-jmeta-l", "/input jump_last_buffer");
- gui_keyboard_bind (NULL, /* m-j,m-p */ "meta-jmeta-p", "/input jump_previous_buffer");
- gui_keyboard_bind (NULL, /* m-j,m-r */ "meta-jmeta-r", "/server raw");
- gui_keyboard_bind (NULL, /* m-h */ "meta-h", "/input hotlist_clear");
- gui_keyboard_bind (NULL, /* m-k */ "meta-k", "/input grab_key");
- gui_keyboard_bind (NULL, /* m-u */ "meta-u", "/input scroll_unread");
- gui_keyboard_bind (NULL, /* ^S^U */ "ctrl-Sctrl-U", "/input set_unread");
- gui_keyboard_bind (NULL, /* ^Cb */ "ctrl-Cb", "/input insert \\x02");
- gui_keyboard_bind (NULL, /* ^Cc */ "ctrl-Cc", "/input insert \\x03");
- gui_keyboard_bind (NULL, /* ^Cc */ "ctrl-Ci", "/input insert \\x1D");
- gui_keyboard_bind (NULL, /* ^Co */ "ctrl-Co", "/input insert \\x0F");
- gui_keyboard_bind (NULL, /* ^Cr */ "ctrl-Cr", "/input insert \\x12");
- gui_keyboard_bind (NULL, /* ^Cu */ "ctrl-Cu", "/input insert \\x15");
- gui_keyboard_bind (NULL, /* m-left */ "meta-meta2-D", "/buffer -1");
- gui_keyboard_bind (NULL, /* m-left (kde) */ "meta2-1;3D", "/buffer -1");
- gui_keyboard_bind (NULL, /* m-up */ "meta-meta2-A", "/buffer -1");
- gui_keyboard_bind (NULL, /* F5 */ "meta2-15~", "/buffer -1");
- gui_keyboard_bind (NULL, /* ^P */ "ctrl-P", "/buffer -1");
- gui_keyboard_bind (NULL, /* m-right */ "meta-meta2-C", "/buffer +1");
- gui_keyboard_bind (NULL, /* m-right (kde) */ "meta2-1;3C", "/buffer +1");
- gui_keyboard_bind (NULL, /* m-down */ "meta-meta2-B", "/buffer +1");
- gui_keyboard_bind (NULL, /* F6 */ "meta2-17~", "/buffer +1");
- gui_keyboard_bind (NULL, /* ^N */ "ctrl-N", "/buffer +1");
- gui_keyboard_bind (NULL, /* pgup */ "meta2-5~", "/window page_up");
- gui_keyboard_bind (NULL, /* pgup */ "meta2-I", "/window page_up");
- gui_keyboard_bind (NULL, /* pgdn */ "meta2-6~", "/window page_down");
- gui_keyboard_bind (NULL, /* pgdn */ "meta2-G", "/window page_down");
- gui_keyboard_bind (NULL, /* m-pgup */ "meta-meta2-5~", "/window scroll_up");
- gui_keyboard_bind (NULL, /* m-pgdn */ "meta-meta2-6~", "/window scroll_down");
- gui_keyboard_bind (NULL, /* m-home */ "meta-meta2-1~", "/window scroll_top");
- gui_keyboard_bind (NULL, /* m-home */ "meta-meta2-7~", "/window scroll_top");
- gui_keyboard_bind (NULL, /* m-end */ "meta-meta2-4~", "/window scroll_bottom");
- gui_keyboard_bind (NULL, /* m-end */ "meta-meta2-8~", "/window scroll_bottom");
- gui_keyboard_bind (NULL, /* m-n */ "meta-n", "/window scroll_next_highlight");
- gui_keyboard_bind (NULL, /* m-p */ "meta-p", "/window scroll_previous_highlight");
- gui_keyboard_bind (NULL, /* F9 */ "meta2-20~", "/bar scroll title * x-50%");
- gui_keyboard_bind (NULL, /* F10 */ "meta2-21~", "/bar scroll title * x+50%");
- gui_keyboard_bind (NULL, /* F11 */ "meta2-23~", "/bar scroll nicklist * y-100%");
- gui_keyboard_bind (NULL, /* F12 */ "meta2-24~", "/bar scroll nicklist * y+100%");
- gui_keyboard_bind (NULL, /* m-F11 */ "meta-meta2-23~", "/bar scroll nicklist * yb");
- gui_keyboard_bind (NULL, /* m-F12 */ "meta-meta2-24~", "/bar scroll nicklist * ye");
- gui_keyboard_bind (NULL, /* ^L */ "ctrl-L", "/window refresh");
- gui_keyboard_bind (NULL, /* F7 */ "meta2-18~", "/window -1");
- gui_keyboard_bind (NULL, /* F8 */ "meta2-19~", "/window +1");
- gui_keyboard_bind (NULL, /* m-w,m-up */ "meta-wmeta-meta2-A", "/window up");
- gui_keyboard_bind (NULL, /* m-w,m-down */ "meta-wmeta-meta2-B", "/window down");
- gui_keyboard_bind (NULL, /* m-w,m-left */ "meta-wmeta-meta2-D", "/window left");
- gui_keyboard_bind (NULL, /* m-w,m-right */ "meta-wmeta-meta2-C", "/window right");
- gui_keyboard_bind (NULL, /* m-z */ "meta-z", "/window zoom");
- gui_keyboard_bind (NULL, /* m-= */ "meta-=", "/filter toggle");
- gui_keyboard_bind (NULL, /* m-0 */ "meta-0", "/buffer 10");
- gui_keyboard_bind (NULL, /* m-1 */ "meta-1", "/buffer 1");
- gui_keyboard_bind (NULL, /* m-2 */ "meta-2", "/buffer 2");
- gui_keyboard_bind (NULL, /* m-3 */ "meta-3", "/buffer 3");
- gui_keyboard_bind (NULL, /* m-4 */ "meta-4", "/buffer 4");
- gui_keyboard_bind (NULL, /* m-5 */ "meta-5", "/buffer 5");
- gui_keyboard_bind (NULL, /* m-6 */ "meta-6", "/buffer 6");
- gui_keyboard_bind (NULL, /* m-7 */ "meta-7", "/buffer 7");
- gui_keyboard_bind (NULL, /* m-8 */ "meta-8", "/buffer 8");
- gui_keyboard_bind (NULL, /* m-9 */ "meta-9", "/buffer 9");
+ gui_keyboard_default_bind (/* RC */ "ctrl-M", "/input return");
+ gui_keyboard_default_bind (/* RC */ "ctrl-J", "/input return");
+ gui_keyboard_default_bind (/* tab */ "ctrl-I", "/input complete_next");
+ gui_keyboard_default_bind (/* s-tab */ "meta2-Z", "/input complete_previous");
+ gui_keyboard_default_bind (/* ^R */ "ctrl-R", "/input search_text");
+ gui_keyboard_default_bind (/* basckpace */ "ctrl-H", "/input delete_previous_char");
+ gui_keyboard_default_bind (/* basckpace */ "ctrl-?", "/input delete_previous_char");
+ gui_keyboard_default_bind (/* del */ "meta2-3~", "/input delete_next_char");
+ gui_keyboard_default_bind (/* ^D */ "ctrl-D", "/input delete_next_char");
+ gui_keyboard_default_bind (/* ^W */ "ctrl-W", "/input delete_previous_word");
+ gui_keyboard_default_bind (/* m-d */ "meta-d", "/input delete_next_word");
+ gui_keyboard_default_bind (/* ^K */ "ctrl-K", "/input delete_end_of_line");
+ gui_keyboard_default_bind (/* m-r */ "meta-r", "/input delete_line");
+ gui_keyboard_default_bind (/* ^T */ "ctrl-T", "/input transpose_chars");
+ gui_keyboard_default_bind (/* ^U */ "ctrl-U", "/input delete_beginning_of_line");
+ gui_keyboard_default_bind (/* ^Y */ "ctrl-Y", "/input clipboard_paste");
+ gui_keyboard_default_bind (/* home */ "meta2-1~", "/input move_beginning_of_line");
+ gui_keyboard_default_bind (/* home */ "meta2-H", "/input move_beginning_of_line");
+ gui_keyboard_default_bind (/* home */ "meta2-7~", "/input move_beginning_of_line");
+ gui_keyboard_default_bind (/* ^A */ "ctrl-A", "/input move_beginning_of_line");
+ gui_keyboard_default_bind (/* end */ "meta2-4~", "/input move_end_of_line");
+ gui_keyboard_default_bind (/* end */ "meta2-F", "/input move_end_of_line");
+ gui_keyboard_default_bind (/* end */ "meta2-8~", "/input move_end_of_line");
+ gui_keyboard_default_bind (/* ^E */ "ctrl-E", "/input move_end_of_line");
+ gui_keyboard_default_bind (/* left */ "meta2-D", "/input move_previous_char");
+ gui_keyboard_default_bind (/* ^B */ "ctrl-B", "/input move_previous_char");
+ gui_keyboard_default_bind (/* right */ "meta2-C", "/input move_next_char");
+ gui_keyboard_default_bind (/* ^F */ "ctrl-F", "/input move_next_char");
+ gui_keyboard_default_bind (/* m-b */ "meta-b", "/input move_previous_word");
+ gui_keyboard_default_bind (/* ^left */ "meta-Od", "/input move_previous_word");
+ gui_keyboard_default_bind (/* m-f */ "meta-f", "/input move_next_word");
+ gui_keyboard_default_bind (/* ^right */ "meta-Oc", "/input move_next_word");
+ gui_keyboard_default_bind (/* up */ "meta2-A", "/input history_previous");
+ gui_keyboard_default_bind (/* down */ "meta2-B", "/input history_next");
+ gui_keyboard_default_bind (/* ^up */ "meta-Oa", "/input history_global_previous");
+ gui_keyboard_default_bind (/* ^down */ "meta-Ob", "/input history_global_next");
+ gui_keyboard_default_bind (/* m-a */ "meta-a", "/input jump_smart");
+ gui_keyboard_default_bind (/* m-j,m-l */ "meta-jmeta-l", "/input jump_last_buffer");
+ gui_keyboard_default_bind (/* m-j,m-p */ "meta-jmeta-p", "/input jump_previous_buffer");
+ gui_keyboard_default_bind (/* m-j,m-r */ "meta-jmeta-r", "/server raw");
+ gui_keyboard_default_bind (/* m-h */ "meta-h", "/input hotlist_clear");
+ gui_keyboard_default_bind (/* m-k */ "meta-k", "/input grab_key");
+ gui_keyboard_default_bind (/* m-s */ "meta-s", "/server switch");
+ gui_keyboard_default_bind (/* m-u */ "meta-u", "/input scroll_unread");
+ gui_keyboard_default_bind (/* ^S^U */ "ctrl-Sctrl-U", "/input set_unread");
+ gui_keyboard_default_bind (/* ^Cb */ "ctrl-Cb", "/input insert \\x02");
+ gui_keyboard_default_bind (/* ^Cc */ "ctrl-Cc", "/input insert \\x03");
+ gui_keyboard_default_bind (/* ^Cc */ "ctrl-Ci", "/input insert \\x1D");
+ gui_keyboard_default_bind (/* ^Co */ "ctrl-Co", "/input insert \\x0F");
+ gui_keyboard_default_bind (/* ^Cr */ "ctrl-Cr", "/input insert \\x12");
+ gui_keyboard_default_bind (/* ^Cu */ "ctrl-Cu", "/input insert \\x15");
+ gui_keyboard_default_bind (/* m-left */ "meta-meta2-D", "/buffer -1");
+ gui_keyboard_default_bind (/* m-left (kde) */ "meta2-1;3D", "/buffer -1");
+ gui_keyboard_default_bind (/* m-up */ "meta-meta2-A", "/buffer -1");
+ gui_keyboard_default_bind (/* F5 */ "meta2-15~", "/buffer -1");
+ gui_keyboard_default_bind (/* ^P */ "ctrl-P", "/buffer -1");
+ gui_keyboard_default_bind (/* m-right */ "meta-meta2-C", "/buffer +1");
+ gui_keyboard_default_bind (/* m-right (kde) */ "meta2-1;3C", "/buffer +1");
+ gui_keyboard_default_bind (/* m-down */ "meta-meta2-B", "/buffer +1");
+ gui_keyboard_default_bind (/* F6 */ "meta2-17~", "/buffer +1");
+ gui_keyboard_default_bind (/* ^N */ "ctrl-N", "/buffer +1");
+ gui_keyboard_default_bind (/* pgup */ "meta2-5~", "/window page_up");
+ gui_keyboard_default_bind (/* pgup */ "meta2-I", "/window page_up");
+ gui_keyboard_default_bind (/* pgdn */ "meta2-6~", "/window page_down");
+ gui_keyboard_default_bind (/* pgdn */ "meta2-G", "/window page_down");
+ gui_keyboard_default_bind (/* m-pgup */ "meta-meta2-5~", "/window scroll_up");
+ gui_keyboard_default_bind (/* m-pgdn */ "meta-meta2-6~", "/window scroll_down");
+ gui_keyboard_default_bind (/* m-home */ "meta-meta2-1~", "/window scroll_top");
+ gui_keyboard_default_bind (/* m-home */ "meta-meta2-7~", "/window scroll_top");
+ gui_keyboard_default_bind (/* m-end */ "meta-meta2-4~", "/window scroll_bottom");
+ gui_keyboard_default_bind (/* m-end */ "meta-meta2-8~", "/window scroll_bottom");
+ gui_keyboard_default_bind (/* m-n */ "meta-n", "/window scroll_next_highlight");
+ gui_keyboard_default_bind (/* m-p */ "meta-p", "/window scroll_previous_highlight");
+ gui_keyboard_default_bind (/* F9 */ "meta2-20~", "/bar scroll title * x-50%");
+ gui_keyboard_default_bind (/* F10 */ "meta2-21~", "/bar scroll title * x+50%");
+ gui_keyboard_default_bind (/* F11 */ "meta2-23~", "/bar scroll nicklist * y-100%");
+ gui_keyboard_default_bind (/* F12 */ "meta2-24~", "/bar scroll nicklist * y+100%");
+ gui_keyboard_default_bind (/* m-F11 */ "meta-meta2-23~", "/bar scroll nicklist * yb");
+ gui_keyboard_default_bind (/* m-F12 */ "meta-meta2-24~", "/bar scroll nicklist * ye");
+ gui_keyboard_default_bind (/* ^L */ "ctrl-L", "/window refresh");
+ gui_keyboard_default_bind (/* F7 */ "meta2-18~", "/window -1");
+ gui_keyboard_default_bind (/* F8 */ "meta2-19~", "/window +1");
+ gui_keyboard_default_bind (/* m-w,m-up */ "meta-wmeta-meta2-A", "/window up");
+ gui_keyboard_default_bind (/* m-w,m-down */ "meta-wmeta-meta2-B", "/window down");
+ gui_keyboard_default_bind (/* m-w,m-left */ "meta-wmeta-meta2-D", "/window left");
+ gui_keyboard_default_bind (/* m-w,m-right */ "meta-wmeta-meta2-C", "/window right");
+ gui_keyboard_default_bind (/* m-z */ "meta-z", "/window zoom");
+ gui_keyboard_default_bind (/* m-= */ "meta-=", "/filter toggle");
+ gui_keyboard_default_bind (/* m-0 */ "meta-0", "/buffer 10");
+ gui_keyboard_default_bind (/* m-1 */ "meta-1", "/buffer 1");
+ gui_keyboard_default_bind (/* m-2 */ "meta-2", "/buffer 2");
+ gui_keyboard_default_bind (/* m-3 */ "meta-3", "/buffer 3");
+ gui_keyboard_default_bind (/* m-4 */ "meta-4", "/buffer 4");
+ gui_keyboard_default_bind (/* m-5 */ "meta-5", "/buffer 5");
+ gui_keyboard_default_bind (/* m-6 */ "meta-6", "/buffer 6");
+ gui_keyboard_default_bind (/* m-7 */ "meta-7", "/buffer 7");
+ gui_keyboard_default_bind (/* m-8 */ "meta-8", "/buffer 8");
+ gui_keyboard_default_bind (/* m-9 */ "meta-9", "/buffer 9");
/* bind meta-j + {01..99} to switch to buffers # > 10 */
for (i = 1; i < 100; i++)
{
sprintf (key_str, "meta-j%02d", i);
sprintf (command, "/buffer %d", i);
- gui_keyboard_bind (NULL, key_str, command);
+ gui_keyboard_default_bind (key_str, command);
}
}
diff --git a/src/gui/gui-keyboard.c b/src/gui/gui-keyboard.c
index f14aa14ae..70ac6d817 100644
--- a/src/gui/gui-keyboard.c
+++ b/src/gui/gui-keyboard.c
@@ -34,6 +34,8 @@
#include "../plugins/plugin.h"
#include "gui-keyboard.h"
#include "gui-buffer.h"
+#include "gui-chat.h"
+#include "gui-color.h"
#include "gui-completion.h"
#include "gui-input.h"
#include "gui-window.h"
@@ -41,6 +43,9 @@
struct t_gui_key *gui_keys = NULL; /* key bindings */
struct t_gui_key *last_gui_key = NULL; /* last key binding */
+int gui_keys_count = 0; /* number of defined keys */
+
+int gui_keyboard_verbose = 0; /* 1 to see some messages */
char gui_key_combo_buffer[128]; /* buffer used for combos */
int gui_key_grab = 0; /* 1 if grab mode enabled (alt-k) */
@@ -67,8 +72,6 @@ gui_keyboard_init ()
gui_key_combo_buffer[0] = '\0';
gui_key_grab = 0;
gui_key_grab_count = 0;
-
- gui_keyboard_default_bindings ();
}
/*
@@ -273,6 +276,8 @@ gui_keyboard_insert_sorted (struct t_gui_key **keys, struct t_gui_key **last_key
*keys = key;
*last_key = key;
}
+
+ gui_keys_count++;
}
/*
@@ -286,20 +291,42 @@ gui_keyboard_new (struct t_gui_buffer *buffer, const char *key,
const char *command)
{
struct t_gui_key *new_key;
- char *internal_code;
+ char *expanded_name;
if ((new_key = malloc (sizeof (*new_key))))
{
- internal_code = gui_keyboard_get_internal_code (key);
- new_key->key = (internal_code) ? strdup (internal_code) : strdup (key);
- if (internal_code)
- free (internal_code);
+ new_key->key = gui_keyboard_get_internal_code (key);
+ if (!new_key->key)
+ new_key->key = strdup (key);
+ if (!new_key->key)
+ {
+ free (new_key);
+ return NULL;
+ }
new_key->command = (command) ? strdup (command) : NULL;
+ if (!new_key->command)
+ {
+ free (new_key);
+ return NULL;
+ }
if (buffer)
gui_keyboard_insert_sorted (&buffer->keys, &buffer->last_key, new_key);
else
gui_keyboard_insert_sorted (&gui_keys, &last_gui_key, new_key);
+
+ if (gui_keyboard_verbose)
+ {
+ expanded_name = gui_keyboard_get_expanded_name (new_key->key);
+ gui_chat_printf (NULL,
+ _("New key binding: %s%s => %s%s"),
+ (expanded_name) ? expanded_name : new_key->key,
+ GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS),
+ GUI_COLOR(GUI_COLOR_CHAT),
+ new_key->command);
+ if (expanded_name)
+ free (expanded_name);
+ }
}
else
return NULL;
@@ -525,6 +552,8 @@ gui_keyboard_free (struct t_gui_key **keys, struct t_gui_key **last_key,
*last_key = key->prev_key;
free (key);
+
+ gui_keys_count--;
}
/*
diff --git a/src/gui/gui-keyboard.h b/src/gui/gui-keyboard.h
index 0fba1e557..5aea4b427 100644
--- a/src/gui/gui-keyboard.h
+++ b/src/gui/gui-keyboard.h
@@ -36,6 +36,8 @@ struct t_gui_key
extern struct t_gui_key *gui_keys;
extern struct t_gui_key *last_gui_key;
+extern int gui_keys_count;
+extern int gui_keyboard_verbose;
extern char gui_key_combo_buffer[];
extern int gui_key_grab;
extern int gui_key_grab_count;
@@ -51,6 +53,9 @@ extern void gui_keyboard_grab_init ();
extern void gui_keyboard_grab_end ();
extern char *gui_keyboard_get_internal_code (const char *key);
extern char *gui_keyboard_get_expanded_name (const char *key);
+extern struct t_gui_key *gui_keyboard_new (struct t_gui_buffer *buffer,
+ const char *key,
+ const char *command);
extern struct t_gui_key *gui_keyboard_search (struct t_gui_buffer *buffer,
const char *key);
extern struct t_gui_key *gui_keyboard_bind (struct t_gui_buffer *buffer,
diff --git a/src/plugins/irc/irc-buffer.c b/src/plugins/irc/irc-buffer.c
index 2539d3b21..8d6989a09 100644
--- a/src/plugins/irc/irc-buffer.c
+++ b/src/plugins/irc/irc-buffer.c
@@ -185,8 +185,6 @@ irc_buffer_merge_servers ()
"name", IRC_BUFFER_ALL_SERVERS_NAME);
weechat_buffer_set (irc_buffer_servers,
"short_name", IRC_BUFFER_ALL_SERVERS_NAME);
- weechat_buffer_set (irc_buffer_servers, "key_bind_meta-s",
- "/command irc /server switch");
weechat_buffer_set (irc_buffer_servers,
"localvar_set_server", IRC_BUFFER_ALL_SERVERS_NAME);
weechat_buffer_set (irc_buffer_servers,
@@ -230,11 +228,6 @@ irc_buffer_split_server ()
struct t_irc_server *ptr_server;
char buffer_name[256], charset_modifier[256];
- if (irc_buffer_servers)
- {
- weechat_buffer_set (irc_buffer_servers, "key_unbind_meta-s", "");
- }
-
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c
index 6f6918c4d..c4b77dabc 100644
--- a/src/plugins/irc/irc-server.c
+++ b/src/plugins/irc/irc-server.c
@@ -2184,9 +2184,6 @@ irc_server_connect (struct t_irc_server *server)
weechat_buffer_set (server->buffer, "display", "auto");
weechat_bar_item_update ("buffer_name");
-
- weechat_buffer_set (server->buffer, "key_bind_meta-s",
- "/command irc /server switch");
}
if (!server->addresses_array)
diff --git a/src/plugins/jabber/jabber-buffer.c b/src/plugins/jabber/jabber-buffer.c
index a52200f9b..bee32ae35 100644
--- a/src/plugins/jabber/jabber-buffer.c
+++ b/src/plugins/jabber/jabber-buffer.c
@@ -185,8 +185,6 @@ jabber_buffer_merge_servers ()
"name", JABBER_BUFFER_ALL_SERVERS_NAME);
weechat_buffer_set (jabber_buffer_servers,
"short_name", JABBER_BUFFER_ALL_SERVERS_NAME);
- weechat_buffer_set (jabber_buffer_servers, "key_bind_meta-s",
- "/command jabber /jabber switch");
weechat_buffer_set (jabber_buffer_servers,
"localvar_set_server", JABBER_BUFFER_ALL_SERVERS_NAME);
weechat_buffer_set (jabber_buffer_servers,
@@ -230,11 +228,6 @@ jabber_buffer_split_server ()
struct t_jabber_server *ptr_server;
char buffer_name[256], charset_modifier[256];
- if (jabber_buffer_servers)
- {
- weechat_buffer_set (jabber_buffer_servers, "key_unbind_meta-s", "");
- }
-
for (ptr_server = jabber_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
diff --git a/src/plugins/jabber/jabber-server.c b/src/plugins/jabber/jabber-server.c
index bb2053e0c..811e1e17b 100644
--- a/src/plugins/jabber/jabber-server.c
+++ b/src/plugins/jabber/jabber-server.c
@@ -1172,9 +1172,6 @@ jabber_server_connect (struct t_jabber_server *server)
weechat_buffer_set (server->buffer, "display", "auto");
weechat_bar_item_update ("buffer_name");
-
- weechat_buffer_set (server->buffer, "key_bind_meta-s",
- "/command jabber /jabber switch");
}
if (!server->address)