summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog.asciidoc1
-rw-r--r--ReleaseNotes.asciidoc15
-rw-r--r--doc/de/autogen/user/weechat_options.asciidoc5
-rw-r--r--doc/en/autogen/user/weechat_options.asciidoc5
-rw-r--r--doc/fr/autogen/user/weechat_options.asciidoc5
-rw-r--r--doc/it/autogen/user/weechat_options.asciidoc5
-rw-r--r--doc/ja/autogen/user/weechat_options.asciidoc5
-rw-r--r--doc/pl/autogen/user/weechat_options.asciidoc5
-rw-r--r--po/cs.po9
-rw-r--r--po/de.po9
-rw-r--r--po/es.po9
-rw-r--r--po/fr.po16
-rw-r--r--po/hu.po9
-rw-r--r--po/it.po9
-rw-r--r--po/ja.po9
-rw-r--r--po/pl.po9
-rw-r--r--po/pt_BR.po9
-rw-r--r--po/ru.po9
-rw-r--r--po/tr.po9
-rw-r--r--po/weechat.pot9
-rw-r--r--src/core/wee-config.c10
-rw-r--r--src/core/wee-config.h1
-rw-r--r--src/gui/gui-completion.c104
23 files changed, 230 insertions, 46 deletions
diff --git a/ChangeLog.asciidoc b/ChangeLog.asciidoc
index 28aab24b4..9ab764f2d 100644
--- a/ChangeLog.asciidoc
+++ b/ChangeLog.asciidoc
@@ -17,6 +17,7 @@ http://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes]
=== New features
+* core: add option weechat.completion.command_inline (task #12491)
* core: add bar item "mouse_status", new options weechat.look.item_mouse_status
and weechat.color.status_mouse (closes #247)
* core: add signals "mouse_enabled" and "mouse_disabled" (closes #244)
diff --git a/ReleaseNotes.asciidoc b/ReleaseNotes.asciidoc
index b1ef0e8e5..67726aa45 100644
--- a/ReleaseNotes.asciidoc
+++ b/ReleaseNotes.asciidoc
@@ -56,6 +56,21 @@ You can restore the default "beep" trigger with the following command:
/trigger restore beep
----
+=== Completion of inline commands
+
+WeeChat now completes by default inline commands (not only at beginning of
+line).
+
+When this feature is enabled, there is no more automatic completion of
+absolute paths (except if you are completing a path inside a command argument,
+like `/dcc send <nick> <path>`).
+
+To restore the old behavior (no completion of inline commands):
+
+----
+/set weechat.completion.command_inline off
+----
+
=== Relay option relay.irc.backlog_tags
The option 'relay.irc.backlog_tags' is now a list separated by commas
diff --git a/doc/de/autogen/user/weechat_options.asciidoc b/doc/de/autogen/user/weechat_options.asciidoc
index 4d8f33aa1..6c2ed743f 100644
--- a/doc/de/autogen/user/weechat_options.asciidoc
+++ b/doc/de/autogen/user/weechat_options.asciidoc
@@ -318,6 +318,11 @@
** Typ: boolesch
** Werte: on, off (Standardwert: `on`)
+* [[option_weechat.completion.command_inline]] *weechat.completion.command_inline*
+** Beschreibung: `if enabled, the commands inside command line are completed (the command at beginning of line has higher priority and is used first); note: when this option is enabled, there is no more automatic completion of paths beginning with '/' (outside commands arguments)`
+** Typ: boolesch
+** Werte: on, off (Standardwert: `on`)
+
* [[option_weechat.completion.default_template]] *weechat.completion.default_template*
** Beschreibung: `Standardvorlage für die automatische Vervollständigung (in der API-Dokumentation findet man die vorgegebenen Codes und Werte, Funktion "weechat_hook_command")`
** Typ: Zeichenkette
diff --git a/doc/en/autogen/user/weechat_options.asciidoc b/doc/en/autogen/user/weechat_options.asciidoc
index 62c9b2aac..ff994a72d 100644
--- a/doc/en/autogen/user/weechat_options.asciidoc
+++ b/doc/en/autogen/user/weechat_options.asciidoc
@@ -318,6 +318,11 @@
** type: boolean
** values: on, off (default value: `on`)
+* [[option_weechat.completion.command_inline]] *weechat.completion.command_inline*
+** description: `if enabled, the commands inside command line are completed (the command at beginning of line has higher priority and is used first); note: when this option is enabled, there is no more automatic completion of paths beginning with '/' (outside commands arguments)`
+** type: boolean
+** values: on, off (default value: `on`)
+
* [[option_weechat.completion.default_template]] *weechat.completion.default_template*
** description: `default completion template (please see documentation for template codes and values: plugin API reference, function "weechat_hook_command")`
** type: string
diff --git a/doc/fr/autogen/user/weechat_options.asciidoc b/doc/fr/autogen/user/weechat_options.asciidoc
index de984440c..2e409a294 100644
--- a/doc/fr/autogen/user/weechat_options.asciidoc
+++ b/doc/fr/autogen/user/weechat_options.asciidoc
@@ -318,6 +318,11 @@
** type: booléen
** valeurs: on, off (valeur par défaut: `on`)
+* [[option_weechat.completion.command_inline]] *weechat.completion.command_inline*
+** description: `si activé, les commandes à l'intérieur de la ligne de commande sont complétées (la commande en début de ligne a une priorité plus élevée et est utilisée en premier) ; note : lorsque cette option est activée, il n'y a plus de complétion automatique des chemins commençant par '/' (en dehors des paramètres de commandes)`
+** type: booléen
+** valeurs: on, off (valeur par défaut: `on`)
+
* [[option_weechat.completion.default_template]] *weechat.completion.default_template*
** description: `modèle de complétion par défaut (merci de consulter la documentation pour les codes et valeurs du modèle : Référence API extension, fonction "weechat_hook_command")`
** type: chaîne
diff --git a/doc/it/autogen/user/weechat_options.asciidoc b/doc/it/autogen/user/weechat_options.asciidoc
index b12df35ae..fdaf40bf9 100644
--- a/doc/it/autogen/user/weechat_options.asciidoc
+++ b/doc/it/autogen/user/weechat_options.asciidoc
@@ -318,6 +318,11 @@
** tipo: bool
** valori: on, off (valore predefinito: `on`)
+* [[option_weechat.completion.command_inline]] *weechat.completion.command_inline*
+** descrizione: `if enabled, the commands inside command line are completed (the command at beginning of line has higher priority and is used first); note: when this option is enabled, there is no more automatic completion of paths beginning with '/' (outside commands arguments)`
+** tipo: bool
+** valori: on, off (valore predefinito: `on`)
+
* [[option_weechat.completion.default_template]] *weechat.completion.default_template*
** descrizione: `modello di completamento predefinito (per favore, consulta la documentazione per codici e valori del template: Referenze API per Plugin, funzione "weechat_hook_command")`
** tipo: stringa
diff --git a/doc/ja/autogen/user/weechat_options.asciidoc b/doc/ja/autogen/user/weechat_options.asciidoc
index 7c4f4f946..21ff9dbb8 100644
--- a/doc/ja/autogen/user/weechat_options.asciidoc
+++ b/doc/ja/autogen/user/weechat_options.asciidoc
@@ -318,6 +318,11 @@
** タイプ: ブール
** 値: on, off (デフォルト値: `on`)
+* [[option_weechat.completion.command_inline]] *weechat.completion.command_inline*
+** 説明: `if enabled, the commands inside command line are completed (the command at beginning of line has higher priority and is used first); note: when this option is enabled, there is no more automatic completion of paths beginning with '/' (outside commands arguments)`
+** タイプ: ブール
+** 値: on, off (デフォルト値: `on`)
+
* [[option_weechat.completion.default_template]] *weechat.completion.default_template*
** 説明: `デフォルトの補完テンプレート (テンプレートコードと値のドキュメントを参照: プラグイン API リファレンス、"weechat_hook_command" 関数)`
** タイプ: 文字列
diff --git a/doc/pl/autogen/user/weechat_options.asciidoc b/doc/pl/autogen/user/weechat_options.asciidoc
index acda6b4fe..675dbfef6 100644
--- a/doc/pl/autogen/user/weechat_options.asciidoc
+++ b/doc/pl/autogen/user/weechat_options.asciidoc
@@ -318,6 +318,11 @@
** typ: bool
** wartości: on, off (domyślna wartość: `on`)
+* [[option_weechat.completion.command_inline]] *weechat.completion.command_inline*
+** opis: `if enabled, the commands inside command line are completed (the command at beginning of line has higher priority and is used first); note: when this option is enabled, there is no more automatic completion of paths beginning with '/' (outside commands arguments)`
+** typ: bool
+** wartości: on, off (domyślna wartość: `on`)
+
* [[option_weechat.completion.default_template]] *weechat.completion.default_template*
** opis: `domyślny szablon dopełnień (zajrzyj do dokumentacji w celu uzyskania kodów i wartości szablonów: opis API wtyczek, funkcja "weechat_hook_command")`
** typ: ciąg
diff --git a/po/cs.po b/po/cs.po
index 88271a609..906d95f36 100644
--- a/po/cs.po
+++ b/po/cs.po
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2014-11-06 20:22+0100\n"
+"POT-Creation-Date: 2014-11-09 11:32+0100\n"
"PO-Revision-Date: 2014-11-01 11:58+0100\n"
"Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -3546,6 +3546,13 @@ msgid ""
"the base word ends at first space after cursor"
msgstr ""
+msgid ""
+"if enabled, the commands inside command line are completed (the command at "
+"beginning of line has higher priority and is used first); note: when this "
+"option is enabled, there is no more automatic completion of paths beginning "
+"with '/' (outside commands arguments)"
+msgstr ""
+
#, fuzzy
msgid ""
"default completion template (please see documentation for template codes and "
diff --git a/po/de.po b/po/de.po
index 9eca61ca8..17a2aa3a3 100644
--- a/po/de.po
+++ b/po/de.po
@@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2014-11-06 20:22+0100\n"
+"POT-Creation-Date: 2014-11-09 11:32+0100\n"
"PO-Revision-Date: 2014-11-06 21:43+0100\n"
"Last-Translator: Nils Görs <weechatter@arcor.de>\n"
"Language-Team: German <weechatter@arcor.de>\n"
@@ -4179,6 +4179,13 @@ msgstr ""
"schon geschriebenen Text, einen Nick einzufügen)"
msgid ""
+"if enabled, the commands inside command line are completed (the command at "
+"beginning of line has higher priority and is used first); note: when this "
+"option is enabled, there is no more automatic completion of paths beginning "
+"with '/' (outside commands arguments)"
+msgstr ""
+
+msgid ""
"default completion template (please see documentation for template codes and "
"values: plugin API reference, function \"weechat_hook_command\")"
msgstr ""
diff --git a/po/es.po b/po/es.po
index eb4830a48..7f5dada5d 100644
--- a/po/es.po
+++ b/po/es.po
@@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2014-11-06 20:22+0100\n"
+"POT-Creation-Date: 2014-11-09 11:32+0100\n"
"PO-Revision-Date: 2014-11-01 11:58+0100\n"
"Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -3760,6 +3760,13 @@ msgstr ""
"cursor, de otra forma la palabra base termina en el primer espacio después "
"del cursor"
+msgid ""
+"if enabled, the commands inside command line are completed (the command at "
+"beginning of line has higher priority and is used first); note: when this "
+"option is enabled, there is no more automatic completion of paths beginning "
+"with '/' (outside commands arguments)"
+msgstr ""
+
#, fuzzy
msgid ""
"default completion template (please see documentation for template codes and "
diff --git a/po/fr.po b/po/fr.po
index e91239577..09c7eea4e 100644
--- a/po/fr.po
+++ b/po/fr.po
@@ -21,8 +21,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2014-11-06 20:22+0100\n"
-"PO-Revision-Date: 2014-11-06 20:23+0100\n"
+"POT-Creation-Date: 2014-11-09 11:32+0100\n"
+"PO-Revision-Date: 2014-11-09 11:33+0100\n"
"Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: fr\n"
@@ -4083,6 +4083,18 @@ msgstr ""
"curseur ; sinon le mot de base s'arrête au premier espace après le curseur"
msgid ""
+"if enabled, the commands inside command line are completed (the command at "
+"beginning of line has higher priority and is used first); note: when this "
+"option is enabled, there is no more automatic completion of paths beginning "
+"with '/' (outside commands arguments)"
+msgstr ""
+"si activé, les commandes à l'intérieur de la ligne de commande sont "
+"complétées (la commande en début de ligne a une priorité plus élevée et est "
+"utilisée en premier) ; note : lorsque cette option est activée, il n'y a "
+"plus de complétion automatique des chemins commençant par '/' (en dehors des "
+"paramètres de commandes)"
+
+msgid ""
"default completion template (please see documentation for template codes and "
"values: plugin API reference, function \"weechat_hook_command\")"
msgstr ""
diff --git a/po/hu.po b/po/hu.po
index c56832497..9604213fe 100644
--- a/po/hu.po
+++ b/po/hu.po
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2014-11-06 20:22+0100\n"
+"POT-Creation-Date: 2014-11-09 11:32+0100\n"
"PO-Revision-Date: 2014-11-01 11:58+0100\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -3179,6 +3179,13 @@ msgid ""
msgstr ""
msgid ""
+"if enabled, the commands inside command line are completed (the command at "
+"beginning of line has higher priority and is used first); note: when this "
+"option is enabled, there is no more automatic completion of paths beginning "
+"with '/' (outside commands arguments)"
+msgstr ""
+
+msgid ""
"default completion template (please see documentation for template codes and "
"values: plugin API reference, function \"weechat_hook_command\")"
msgstr ""
diff --git a/po/it.po b/po/it.po
index fb8de4f0a..53b29de50 100644
--- a/po/it.po
+++ b/po/it.po
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2014-11-06 20:22+0100\n"
+"POT-Creation-Date: 2014-11-09 11:32+0100\n"
"PO-Revision-Date: 2014-11-01 11:58+0100\n"
"Last-Translator: Esteban I. Ruiz Moreno <exio4.com@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -3869,6 +3869,13 @@ msgstr ""
"cursore; altrimenti la parola base termina al primo spazio dopo il cursore"
msgid ""
+"if enabled, the commands inside command line are completed (the command at "
+"beginning of line has higher priority and is used first); note: when this "
+"option is enabled, there is no more automatic completion of paths beginning "
+"with '/' (outside commands arguments)"
+msgstr ""
+
+msgid ""
"default completion template (please see documentation for template codes and "
"values: plugin API reference, function \"weechat_hook_command\")"
msgstr ""
diff --git a/po/ja.po b/po/ja.po
index 41e4bf842..178609fcf 100644
--- a/po/ja.po
+++ b/po/ja.po
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2014-11-06 20:22+0100\n"
+"POT-Creation-Date: 2014-11-09 11:32+0100\n"
"PO-Revision-Date: 2014-11-01 11:58+0100\n"
"Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n"
"Language-Team: Japanese <https://github.com/l/weechat/tree/translation_ja>\n"
@@ -3917,6 +3917,13 @@ msgstr ""
"語はカーソル後の最初の文字で終了"
msgid ""
+"if enabled, the commands inside command line are completed (the command at "
+"beginning of line has higher priority and is used first); note: when this "
+"option is enabled, there is no more automatic completion of paths beginning "
+"with '/' (outside commands arguments)"
+msgstr ""
+
+msgid ""
"default completion template (please see documentation for template codes and "
"values: plugin API reference, function \"weechat_hook_command\")"
msgstr ""
diff --git a/po/pl.po b/po/pl.po
index 51b53eecd..c38a86972 100644
--- a/po/pl.po
+++ b/po/pl.po
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2014-11-06 20:22+0100\n"
+"POT-Creation-Date: 2014-11-09 11:32+0100\n"
"PO-Revision-Date: 2014-11-01 11:58+0100\n"
"Last-Translator: Krzysztof Korościk <soltys@szluug.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -4010,6 +4010,13 @@ msgstr ""
"kursorze"
msgid ""
+"if enabled, the commands inside command line are completed (the command at "
+"beginning of line has higher priority and is used first); note: when this "
+"option is enabled, there is no more automatic completion of paths beginning "
+"with '/' (outside commands arguments)"
+msgstr ""
+
+msgid ""
"default completion template (please see documentation for template codes and "
"values: plugin API reference, function \"weechat_hook_command\")"
msgstr ""
diff --git a/po/pt_BR.po b/po/pt_BR.po
index dbfd82e46..41cb94854 100644
--- a/po/pt_BR.po
+++ b/po/pt_BR.po
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2014-11-06 20:22+0100\n"
+"POT-Creation-Date: 2014-11-09 11:32+0100\n"
"PO-Revision-Date: 2014-11-01 11:59+0100\n"
"Last-Translator: Sergio Durigan Junior <sergiosdj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -3653,6 +3653,13 @@ msgid ""
"the base word ends at first space after cursor"
msgstr ""
+msgid ""
+"if enabled, the commands inside command line are completed (the command at "
+"beginning of line has higher priority and is used first); note: when this "
+"option is enabled, there is no more automatic completion of paths beginning "
+"with '/' (outside commands arguments)"
+msgstr ""
+
#, fuzzy
msgid ""
"default completion template (please see documentation for template codes and "
diff --git a/po/ru.po b/po/ru.po
index 527472769..387ab7782 100644
--- a/po/ru.po
+++ b/po/ru.po
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2014-11-06 20:22+0100\n"
+"POT-Creation-Date: 2014-11-09 11:32+0100\n"
"PO-Revision-Date: 2014-11-01 11:59+0100\n"
"Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -3209,6 +3209,13 @@ msgid ""
msgstr ""
msgid ""
+"if enabled, the commands inside command line are completed (the command at "
+"beginning of line has higher priority and is used first); note: when this "
+"option is enabled, there is no more automatic completion of paths beginning "
+"with '/' (outside commands arguments)"
+msgstr ""
+
+msgid ""
"default completion template (please see documentation for template codes and "
"values: plugin API reference, function \"weechat_hook_command\")"
msgstr ""
diff --git a/po/tr.po b/po/tr.po
index 9d9a7a866..0a8ac1ba7 100644
--- a/po/tr.po
+++ b/po/tr.po
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2014-11-06 20:22+0100\n"
+"POT-Creation-Date: 2014-11-09 11:32+0100\n"
"PO-Revision-Date: 2014-07-25 07:50+0200\n"
"Last-Translator: Hasan Kiran <sunder67@hotmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -2856,6 +2856,13 @@ msgid ""
msgstr ""
msgid ""
+"if enabled, the commands inside command line are completed (the command at "
+"beginning of line has higher priority and is used first); note: when this "
+"option is enabled, there is no more automatic completion of paths beginning "
+"with '/' (outside commands arguments)"
+msgstr ""
+
+msgid ""
"default completion template (please see documentation for template codes and "
"values: plugin API reference, function \"weechat_hook_command\")"
msgstr ""
diff --git a/po/weechat.pot b/po/weechat.pot
index 1ab6bde1f..2517151ff 100644
--- a/po/weechat.pot
+++ b/po/weechat.pot
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2014-11-06 20:22+0100\n"
+"POT-Creation-Date: 2014-11-09 11:32+0100\n"
"PO-Revision-Date: 2014-08-16 10:27+0200\n"
"Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -2853,6 +2853,13 @@ msgid ""
msgstr ""
msgid ""
+"if enabled, the commands inside command line are completed (the command at "
+"beginning of line has higher priority and is used first); note: when this "
+"option is enabled, there is no more automatic completion of paths beginning "
+"with '/' (outside commands arguments)"
+msgstr ""
+
+msgid ""
"default completion template (please see documentation for template codes and "
"values: plugin API reference, function \"weechat_hook_command\")"
msgstr ""
diff --git a/src/core/wee-config.c b/src/core/wee-config.c
index 163115683..cb65ae312 100644
--- a/src/core/wee-config.c
+++ b/src/core/wee-config.c
@@ -244,6 +244,7 @@ struct t_config_option *config_color_nicklist_offline;
/* config, completion section */
struct t_config_option *config_completion_base_word_until_cursor;
+struct t_config_option *config_completion_command_inline;
struct t_config_option *config_completion_default_template;
struct t_config_option *config_completion_nick_add_space;
struct t_config_option *config_completion_nick_completer;
@@ -3192,6 +3193,15 @@ config_weechat_init_options ()
N_("if enabled, the base word to complete ends at char before cursor; "
"otherwise the base word ends at first space after cursor"),
NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+ config_completion_command_inline = config_file_new_option (
+ weechat_config_file, ptr_section,
+ "command_inline", "boolean",
+ N_("if enabled, the commands inside command line are completed (the "
+ "command at beginning of line has higher priority and is used "
+ "first); note: when this option is enabled, there is no more "
+ "automatic completion of paths beginning with '/' (outside "
+ "commands arguments)"),
+ NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
config_completion_default_template = config_file_new_option (
weechat_config_file, ptr_section,
"default_template", "string",
diff --git a/src/core/wee-config.h b/src/core/wee-config.h
index 181d24129..862490415 100644
--- a/src/core/wee-config.h
+++ b/src/core/wee-config.h
@@ -277,6 +277,7 @@ extern struct t_config_option *config_color_nicklist_group;
extern struct t_config_option *config_color_nicklist_offline;
extern struct t_config_option *config_completion_base_word_until_cursor;
+extern struct t_config_option *config_completion_command_inline;
extern struct t_config_option *config_completion_default_template;
extern struct t_config_option *config_completion_nick_add_space;
extern struct t_config_option *config_completion_nick_completer;
diff --git a/src/gui/gui-completion.c b/src/gui/gui-completion.c
index 6a796c823..21a8c6d35 100644
--- a/src/gui/gui-completion.c
+++ b/src/gui/gui-completion.c
@@ -705,33 +705,77 @@ void
gui_completion_find_context (struct t_gui_completion *completion,
const char *data, int size, int pos)
{
- int i, command, command_arg, pos_start, pos_end;
+ int i, command_arg, pos_start, pos_end;
+ const char *ptr_command, *ptr_data;
char *prev_char;
/* look for context */
gui_completion_free_data (completion);
gui_completion_buffer_init (completion, completion->buffer);
- command = (string_is_command_char (data)) ? 1 : 0;
+ ptr_command = NULL;
command_arg = 0;
- i = 0;
- while (i < pos)
+
+ /* check if data starts with a command */
+ ptr_data = data;
+ if (string_is_command_char (ptr_data))
{
- if (data[i] == ' ')
+ ptr_data = utf8_next_char (ptr_data);
+ if (ptr_data < data + pos)
{
- command_arg++;
- i++;
- while ((i < pos) && (data[i] == ' '))
+ if (string_is_command_char (ptr_data))
+ ptr_data = utf8_next_char (ptr_data);
+ }
+ if (!string_is_command_char (ptr_data))
+ ptr_command = ptr_data;
+ }
+
+ /*
+ * search for the last command in data (only if there is no command at
+ * beginning and if completion of inline commands is enabled)
+ */
+ if (!ptr_command && CONFIG_BOOLEAN(config_completion_command_inline))
+ {
+ ptr_data = data;
+ while (ptr_data && (ptr_data < data + pos))
+ {
+ ptr_data = strchr (ptr_data, ' ');
+ if (!ptr_data)
+ break;
+ if (ptr_data < data + pos)
{
- i++;
+ while ((ptr_data < data + pos) && (ptr_data[0] == ' '))
+ {
+ ptr_data++;
+ }
+ }
+ if ((ptr_data < data + pos) && string_is_command_char (ptr_data))
+ {
+ ptr_data = utf8_next_char (ptr_data);
+ if (!string_is_command_char (ptr_data))
+ ptr_command = ptr_data;
}
- if (!completion->args)
- completion->args = strdup (data + i);
}
- else
- i++;
}
- if (command)
+
+ if (ptr_command)
{
+ /* search argument number and string with arguments */
+ ptr_data = ptr_command;
+ while (ptr_data < data + pos)
+ {
+ ptr_data = strchr (ptr_data, ' ');
+ if (!ptr_data)
+ break;
+ command_arg++;
+ while ((ptr_data < data + pos) && (ptr_data[0] == ' '))
+ {
+ ptr_data++;
+ }
+ if (!completion->args)
+ completion->args = strdup (ptr_data);
+ }
+
+ /* set completion context */
if (command_arg > 0)
{
completion->context = GUI_COMPLETION_COMMAND_ARG;
@@ -817,35 +861,29 @@ gui_completion_find_context (struct t_gui_completion *completion,
/* find command (for command argument completion only) */
if (completion->context == GUI_COMPLETION_COMMAND_ARG)
{
- pos_start = 0;
- while ((pos_start < size) && !string_is_command_char (data + pos_start))
+ pos_start = ptr_command - data;
+ pos_end = pos_start;
+ while ((pos_end < size) && (data[pos_end] != ' '))
{
- pos_start += utf8_char_size (data + pos_start);
+ pos_end += utf8_char_size (data + pos_end);
}
- if (string_is_command_char (data + pos_start))
+ if (data[pos_end] == ' ')
+ {
+ prev_char = utf8_prev_char (data, data + pos_end);
+ pos_end -= utf8_char_size (prev_char);
+ }
+ if (pos_end >= pos_start)
{
- pos_start += utf8_char_size (data + pos_start);
- if (string_is_command_char (data + pos_start))
- pos_start += utf8_char_size (data + pos_start);
- pos_end = pos_start;
- while ((pos_end < size) && (data[pos_end] != ' '))
- {
- pos_end += utf8_char_size (data + pos_end);
- }
- if (data[pos_end] == ' ')
- {
- prev_char = utf8_prev_char (data, data + pos_end);
- pos_end -= utf8_char_size (prev_char);
- }
-
completion->base_command = malloc (pos_end - pos_start + 2);
for (i = pos_start; i <= pos_end; i++)
{
completion->base_command[i - pos_start] = data[i];
}
completion->base_command[pos_end - pos_start + 1] = '\0';
- gui_completion_build_list (completion);
}
+ else
+ completion->base_command = strdup ("");
+ gui_completion_build_list (completion);
}
/*