summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog.asciidoc2
-rw-r--r--ReleaseNotes.asciidoc17
-rw-r--r--doc/de/autogen/user/weechat_options.asciidoc10
-rw-r--r--doc/en/autogen/user/weechat_options.asciidoc10
-rw-r--r--doc/fr/autogen/user/weechat_options.asciidoc10
-rw-r--r--doc/it/autogen/user/weechat_options.asciidoc10
-rw-r--r--doc/ja/autogen/user/weechat_options.asciidoc10
-rw-r--r--doc/pl/autogen/user/weechat_options.asciidoc10
-rw-r--r--po/cs.po22
-rw-r--r--po/de.po22
-rw-r--r--po/es.po22
-rw-r--r--po/fr.po42
-rw-r--r--po/hu.po22
-rw-r--r--po/it.po22
-rw-r--r--po/ja.po44
-rw-r--r--po/pl.po22
-rw-r--r--po/pt_BR.po22
-rw-r--r--po/ru.po22
-rw-r--r--po/tr.po22
-rw-r--r--po/weechat.pot22
-rw-r--r--src/core/wee-config.c177
-rw-r--r--src/core/wee-config.h15
-rw-r--r--src/core/wee-string.c87
-rw-r--r--src/core/wee-string.h3
-rw-r--r--src/gui/gui-input.c16
-rw-r--r--tests/unit/core/test-string.cpp41
26 files changed, 662 insertions, 62 deletions
diff --git a/ChangeLog.asciidoc b/ChangeLog.asciidoc
index 706609465..fa99a8f54 100644
--- a/ChangeLog.asciidoc
+++ b/ChangeLog.asciidoc
@@ -19,6 +19,8 @@ https://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes]
=== New features
+* core: add options weechat.look.word_chars_{highlight|input}
+ (closes #55, task #9459)
* core: display a warning on startup if the locale can not be set (closes #373)
* core: allow "*" as plugin name in command /plugin reload to reload all
plugins with options
diff --git a/ReleaseNotes.asciidoc b/ReleaseNotes.asciidoc
index d22929397..579272cb3 100644
--- a/ReleaseNotes.asciidoc
+++ b/ReleaseNotes.asciidoc
@@ -17,6 +17,23 @@ https://weechat.org/files/changelog/ChangeLog-devel.html[ChangeLog]
(file 'ChangeLog.asciidoc' in sources).
+== Version 1.2 (under dev)
+
+The word chars are now customizable with two options:
+
+* weechat.look.word_chars_highlight
+* weechat.look.word_chars_input
+
+The behavior has changed for command line: now any non-word char is used as
+delimiter for keys to move to previous/next word or delete previous/next word.
+
+You can restore the old behavior (only use spaces as delimiters) with this
+command:
+
+----
+/set weechat.look.word_chars_input "!\u00A0,!\x20,*"
+----
+
== Version 1.1.1 (2015-01-25)
Bug fix and maintenance release.
diff --git a/doc/de/autogen/user/weechat_options.asciidoc b/doc/de/autogen/user/weechat_options.asciidoc
index 2595e5587..85d6d0500 100644
--- a/doc/de/autogen/user/weechat_options.asciidoc
+++ b/doc/de/autogen/user/weechat_options.asciidoc
@@ -912,6 +912,16 @@
** Typ: Zeichenkette
** Werte: beliebige Zeichenkette (Standardwert: `"WeeChat ${info:version}"`)
+* [[option_weechat.look.word_chars_highlight]] *weechat.look.word_chars_highlight*
+** Beschreibung: `comma-separated list of chars (or range of chars) that are considered part or words for highlights; each item can be a single char, a range of chars (format: a-z), a class of wide character (for example "alnum", see man wctype); a "!" before the item makes it negative (ie the char is NOT considered part of words); the value "*" matches any char; unicode chars are allowed with the format \u1234, for example \u00A0 for unbreakable space (see /help print for supported formats)`
+** Typ: Zeichenkette
+** Werte: beliebige Zeichenkette (Standardwert: `"!\u00A0,-,_,|,alnum"`)
+
+* [[option_weechat.look.word_chars_input]] *weechat.look.word_chars_input*
+** Beschreibung: `comma-separated list of chars (or range of chars) that are considered part or words for command line; each item can be a single char, a range of chars (format: a-z), a class of wide character (for example "alnum", see man wctype); a "!" before the item makes it negative (ie the char is NOT considered part of words); the value "*" matches any char; unicode chars are allowed with the format \u1234, for example \u00A0 for unbreakable space (see /help print for supported formats)`
+** Typ: Zeichenkette
+** Werte: beliebige Zeichenkette (Standardwert: `"!\u00A0,-,_,|,alnum"`)
+
* [[option_weechat.network.connection_timeout]] *weechat.network.connection_timeout*
** Beschreibung: `Zeitüberschreitung (in Sekunden) für eine Verbindung zu einem entfernten Rechner (mittels einem Kindprozess)`
** Typ: integer
diff --git a/doc/en/autogen/user/weechat_options.asciidoc b/doc/en/autogen/user/weechat_options.asciidoc
index 88c3fa73f..0bd7ac022 100644
--- a/doc/en/autogen/user/weechat_options.asciidoc
+++ b/doc/en/autogen/user/weechat_options.asciidoc
@@ -912,6 +912,16 @@
** type: string
** values: any string (default value: `"WeeChat ${info:version}"`)
+* [[option_weechat.look.word_chars_highlight]] *weechat.look.word_chars_highlight*
+** description: `comma-separated list of chars (or range of chars) that are considered part or words for highlights; each item can be a single char, a range of chars (format: a-z), a class of wide character (for example "alnum", see man wctype); a "!" before the item makes it negative (ie the char is NOT considered part of words); the value "*" matches any char; unicode chars are allowed with the format \u1234, for example \u00A0 for unbreakable space (see /help print for supported formats)`
+** type: string
+** values: any string (default value: `"!\u00A0,-,_,|,alnum"`)
+
+* [[option_weechat.look.word_chars_input]] *weechat.look.word_chars_input*
+** description: `comma-separated list of chars (or range of chars) that are considered part or words for command line; each item can be a single char, a range of chars (format: a-z), a class of wide character (for example "alnum", see man wctype); a "!" before the item makes it negative (ie the char is NOT considered part of words); the value "*" matches any char; unicode chars are allowed with the format \u1234, for example \u00A0 for unbreakable space (see /help print for supported formats)`
+** type: string
+** values: any string (default value: `"!\u00A0,-,_,|,alnum"`)
+
* [[option_weechat.network.connection_timeout]] *weechat.network.connection_timeout*
** description: `timeout (in seconds) for connection to a remote host (made in a child process)`
** type: integer
diff --git a/doc/fr/autogen/user/weechat_options.asciidoc b/doc/fr/autogen/user/weechat_options.asciidoc
index d2e6967b8..cafe3f320 100644
--- a/doc/fr/autogen/user/weechat_options.asciidoc
+++ b/doc/fr/autogen/user/weechat_options.asciidoc
@@ -912,6 +912,16 @@
** type: chaîne
** valeurs: toute chaîne (valeur par défaut: `"WeeChat ${info:version}"`)
+* [[option_weechat.look.word_chars_highlight]] *weechat.look.word_chars_highlight*
+** description: `liste de caractères séparés pas des virgules (ou intervalle de caractères) qui sont considérés comme faisant partie des mots pour les highlights ; chaque élément peut être un simple caractère, un intervalle de caractères (format : a-z), une classe de caractère large (par exemple "alnum", voir man wctype) ; un "!" avant un élément le rend négatif (c'est-à-dire le caractère ne fait PAS partie des mots) ; la valeur "*" correspond à n'importe quel caractère ; les caractères unicode sont autorisés avec le format \u1234, par exemple \u00A0 pour l'espace insécable (voir /help print pour les formats supportés)`
+** type: chaîne
+** valeurs: toute chaîne (valeur par défaut: `"!\u00A0,-,_,|,alnum"`)
+
+* [[option_weechat.look.word_chars_input]] *weechat.look.word_chars_input*
+** description: `liste de caractères séparés pas des virgules (ou intervalle de caractères) qui sont considérés comme faisant partie des mots pour la ligne de commande ; chaque élément peut être un simple caractère, un intervalle de caractères (format : a-z), une classe de caractère large (par exemple "alnum", voir man wctype) ; un "!" avant un élément le rend négatif (c'est-à-dire le caractère ne fait PAS partie des mots) ; la valeur "*" correspond à n'importe quel caractère ; les caractères unicode sont autorisés avec le format \u1234, par exemple \u00A0 pour l'espace insécable (voir /help print pour les formats supportés)`
+** type: chaîne
+** valeurs: toute chaîne (valeur par défaut: `"!\u00A0,-,_,|,alnum"`)
+
* [[option_weechat.network.connection_timeout]] *weechat.network.connection_timeout*
** description: `délai d'attente maximum (en secondes) pour la connexion à une machine distante (effectuée dans un processus fils)`
** type: entier
diff --git a/doc/it/autogen/user/weechat_options.asciidoc b/doc/it/autogen/user/weechat_options.asciidoc
index 36bfba9e9..7ddd62fe4 100644
--- a/doc/it/autogen/user/weechat_options.asciidoc
+++ b/doc/it/autogen/user/weechat_options.asciidoc
@@ -912,6 +912,16 @@
** tipo: stringa
** valori: qualsiasi stringa (valore predefinito: `"WeeChat ${info:version}"`)
+* [[option_weechat.look.word_chars_highlight]] *weechat.look.word_chars_highlight*
+** descrizione: `comma-separated list of chars (or range of chars) that are considered part or words for highlights; each item can be a single char, a range of chars (format: a-z), a class of wide character (for example "alnum", see man wctype); a "!" before the item makes it negative (ie the char is NOT considered part of words); the value "*" matches any char; unicode chars are allowed with the format \u1234, for example \u00A0 for unbreakable space (see /help print for supported formats)`
+** tipo: stringa
+** valori: qualsiasi stringa (valore predefinito: `"!\u00A0,-,_,|,alnum"`)
+
+* [[option_weechat.look.word_chars_input]] *weechat.look.word_chars_input*
+** descrizione: `comma-separated list of chars (or range of chars) that are considered part or words for command line; each item can be a single char, a range of chars (format: a-z), a class of wide character (for example "alnum", see man wctype); a "!" before the item makes it negative (ie the char is NOT considered part of words); the value "*" matches any char; unicode chars are allowed with the format \u1234, for example \u00A0 for unbreakable space (see /help print for supported formats)`
+** tipo: stringa
+** valori: qualsiasi stringa (valore predefinito: `"!\u00A0,-,_,|,alnum"`)
+
* [[option_weechat.network.connection_timeout]] *weechat.network.connection_timeout*
** descrizione: `timeout (in secondi) per la connessione ad un host remoto (eseguita in un processo figlio)`
** tipo: intero
diff --git a/doc/ja/autogen/user/weechat_options.asciidoc b/doc/ja/autogen/user/weechat_options.asciidoc
index 85a2d629e..819f68222 100644
--- a/doc/ja/autogen/user/weechat_options.asciidoc
+++ b/doc/ja/autogen/user/weechat_options.asciidoc
@@ -912,6 +912,16 @@
** タイプ: 文字列
** 値: 未制約文字列 (デフォルト値: `"WeeChat ${info:version}"`)
+* [[option_weechat.look.word_chars_highlight]] *weechat.look.word_chars_highlight*
+** 説明: `comma-separated list of chars (or range of chars) that are considered part or words for highlights; each item can be a single char, a range of chars (format: a-z), a class of wide character (for example "alnum", see man wctype); a "!" before the item makes it negative (ie the char is NOT considered part of words); the value "*" matches any char; unicode chars are allowed with the format \u1234, for example \u00A0 for unbreakable space (see /help print for supported formats)`
+** タイプ: 文字列
+** 値: 未制約文字列 (デフォルト値: `"!\u00A0,-,_,|,alnum"`)
+
+* [[option_weechat.look.word_chars_input]] *weechat.look.word_chars_input*
+** 説明: `comma-separated list of chars (or range of chars) that are considered part or words for command line; each item can be a single char, a range of chars (format: a-z), a class of wide character (for example "alnum", see man wctype); a "!" before the item makes it negative (ie the char is NOT considered part of words); the value "*" matches any char; unicode chars are allowed with the format \u1234, for example \u00A0 for unbreakable space (see /help print for supported formats)`
+** タイプ: 文字列
+** 値: 未制約文字列 (デフォルト値: `"!\u00A0,-,_,|,alnum"`)
+
* [[option_weechat.network.connection_timeout]] *weechat.network.connection_timeout*
** 説明: `リモートホストへの接続タイムアウト時間 (秒単位) (子プロセスが行う)`
** タイプ: 整数
diff --git a/doc/pl/autogen/user/weechat_options.asciidoc b/doc/pl/autogen/user/weechat_options.asciidoc
index f9fd43c2f..0e8fb566a 100644
--- a/doc/pl/autogen/user/weechat_options.asciidoc
+++ b/doc/pl/autogen/user/weechat_options.asciidoc
@@ -912,6 +912,16 @@
** typ: ciąg
** wartości: dowolny ciąg (domyślna wartość: `"WeeChat ${info:version}"`)
+* [[option_weechat.look.word_chars_highlight]] *weechat.look.word_chars_highlight*
+** opis: `comma-separated list of chars (or range of chars) that are considered part or words for highlights; each item can be a single char, a range of chars (format: a-z), a class of wide character (for example "alnum", see man wctype); a "!" before the item makes it negative (ie the char is NOT considered part of words); the value "*" matches any char; unicode chars are allowed with the format \u1234, for example \u00A0 for unbreakable space (see /help print for supported formats)`
+** typ: ciąg
+** wartości: dowolny ciąg (domyślna wartość: `"!\u00A0,-,_,|,alnum"`)
+
+* [[option_weechat.look.word_chars_input]] *weechat.look.word_chars_input*
+** opis: `comma-separated list of chars (or range of chars) that are considered part or words for command line; each item can be a single char, a range of chars (format: a-z), a class of wide character (for example "alnum", see man wctype); a "!" before the item makes it negative (ie the char is NOT considered part of words); the value "*" matches any char; unicode chars are allowed with the format \u1234, for example \u00A0 for unbreakable space (see /help print for supported formats)`
+** typ: ciąg
+** wartości: dowolny ciąg (domyślna wartość: `"!\u00A0,-,_,|,alnum"`)
+
* [[option_weechat.network.connection_timeout]] *weechat.network.connection_timeout*
** opis: `czas oczekiwania (w sekundach) na połączenie ze zdalnym serwerem (wykonywane w procesie potomnym)`
** typ: liczba
diff --git a/po/cs.po b/po/cs.po
index 88e0142be..6004162e6 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: 2015-03-30 19:14+0200\n"
+"POT-Creation-Date: 2015-04-11 18:40+0200\n"
"PO-Revision-Date: 2015-03-21 08:41+0100\n"
"Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -3339,6 +3339,26 @@ msgid ""
"will keep title unchanged (note: content is evaluated, see /help eval)"
msgstr "příkaz spuštěný při startu WeeChat, před načtením pluginů"
+msgid ""
+"comma-separated list of chars (or range of chars) that are considered part "
+"or words for highlights; each item can be a single char, a range of chars "
+"(format: a-z), a class of wide character (for example \"alnum\", see man "
+"wctype); a \"!\" before the item makes it negative (ie the char is NOT "
+"considered part of words); the value \"*\" matches any char; unicode chars "
+"are allowed with the format \\u1234, for example \\u00A0 for unbreakable "
+"space (see /help print for supported formats)"
+msgstr ""
+
+msgid ""
+"comma-separated list of chars (or range of chars) that are considered part "
+"or words for command line; each item can be a single char, a range of chars "
+"(format: a-z), a class of wide character (for example \"alnum\", see man "
+"wctype); a \"!\" before the item makes it negative (ie the char is NOT "
+"considered part of words); the value \"*\" matches any char; unicode chars "
+"are allowed with the format \\u1234, for example \\u00A0 for unbreakable "
+"space (see /help print for supported formats)"
+msgstr ""
+
msgid "text color for '+' when scrolling bars"
msgstr "barva textu pro '+' při posouvání polí"
diff --git a/po/de.po b/po/de.po
index 18d1c84fe..4d1d84c8a 100644
--- a/po/de.po
+++ b/po/de.po
@@ -24,7 +24,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2015-03-30 19:14+0200\n"
+"POT-Creation-Date: 2015-04-11 18:40+0200\n"
"PO-Revision-Date: 2015-03-31 09:13+0200\n"
"Last-Translator: Nils Görs <weechatter@arcor.de>\n"
"Language-Team: German <>\n"
@@ -3958,6 +3958,26 @@ msgstr ""
"Programmstart gesetzt; ein leerer Eintrag belässt den original Fenstertitel "
"(Hinweis: Inhalt wird evaluiert, siehe /help eval)"
+msgid ""
+"comma-separated list of chars (or range of chars) that are considered part "
+"or words for highlights; each item can be a single char, a range of chars "
+"(format: a-z), a class of wide character (for example \"alnum\", see man "
+"wctype); a \"!\" before the item makes it negative (ie the char is NOT "
+"considered part of words); the value \"*\" matches any char; unicode chars "
+"are allowed with the format \\u1234, for example \\u00A0 for unbreakable "
+"space (see /help print for supported formats)"
+msgstr ""
+
+msgid ""
+"comma-separated list of chars (or range of chars) that are considered part "
+"or words for command line; each item can be a single char, a range of chars "
+"(format: a-z), a class of wide character (for example \"alnum\", see man "
+"wctype); a \"!\" before the item makes it negative (ie the char is NOT "
+"considered part of words); the value \"*\" matches any char; unicode chars "
+"are allowed with the format \\u1234, for example \\u00A0 for unbreakable "
+"space (see /help print for supported formats)"
+msgstr ""
+
msgid "text color for '+' when scrolling bars"
msgstr "Farbe des '+' beim Scrollen von Info-Bars"
diff --git a/po/es.po b/po/es.po
index ab1632b8c..e0a58d852 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: 2015-03-30 19:14+0200\n"
+"POT-Creation-Date: 2015-04-11 18:40+0200\n"
"PO-Revision-Date: 2015-03-21 08:41+0100\n"
"Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -3535,6 +3535,26 @@ msgid ""
"will keep title unchanged (note: content is evaluated, see /help eval)"
msgstr "comando ejecutado cuando WeeChat inicia, antes de cargar los plugins"
+msgid ""
+"comma-separated list of chars (or range of chars) that are considered part "
+"or words for highlights; each item can be a single char, a range of chars "
+"(format: a-z), a class of wide character (for example \"alnum\", see man "
+"wctype); a \"!\" before the item makes it negative (ie the char is NOT "
+"considered part of words); the value \"*\" matches any char; unicode chars "
+"are allowed with the format \\u1234, for example \\u00A0 for unbreakable "
+"space (see /help print for supported formats)"
+msgstr ""
+
+msgid ""
+"comma-separated list of chars (or range of chars) that are considered part "
+"or words for command line; each item can be a single char, a range of chars "
+"(format: a-z), a class of wide character (for example \"alnum\", see man "
+"wctype); a \"!\" before the item makes it negative (ie the char is NOT "
+"considered part of words); the value \"*\" matches any char; unicode chars "
+"are allowed with the format \\u1234, for example \\u00A0 for unbreakable "
+"space (see /help print for supported formats)"
+msgstr ""
+
msgid "text color for '+' when scrolling bars"
msgstr "color del '+' cuando se desplaza las barras"
diff --git a/po/fr.po b/po/fr.po
index 42f1bacc5..39062042e 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: 2015-03-30 19:14+0200\n"
-"PO-Revision-Date: 2015-03-30 19:14+0200\n"
+"POT-Creation-Date: 2015-04-11 18:40+0200\n"
+"PO-Revision-Date: 2015-04-11 18:42+0200\n"
"Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: fr\n"
@@ -3843,6 +3843,44 @@ msgstr ""
"démarrage ; une chaîne vide gardera le titre inchangé (note : le contenu est "
"évalué, voir /help eval)"
+msgid ""
+"comma-separated list of chars (or range of chars) that are considered part "
+"or words for highlights; each item can be a single char, a range of chars "
+"(format: a-z), a class of wide character (for example \"alnum\", see man "
+"wctype); a \"!\" before the item makes it negative (ie the char is NOT "
+"considered part of words); the value \"*\" matches any char; unicode chars "
+"are allowed with the format \\u1234, for example \\u00A0 for unbreakable "
+"space (see /help print for supported formats)"
+msgstr ""
+"liste de caractères séparés pas des virgules (ou intervalle de caractères) "
+"qui sont considérés comme faisant partie des mots pour les highlights ; "
+"chaque élément peut être un simple caractère, un intervalle de caractères "
+"(format : a-z), une classe de caractère large (par exemple \"alnum\", voir "
+"man wctype) ; un \"!\" avant un élément le rend négatif (c'est-à-dire le "
+"caractère ne fait PAS partie des mots) ; la valeur \"*\" correspond à "
+"n'importe quel caractère ; les caractères unicode sont autorisés avec le "
+"format \\u1234, par exemple \\u00A0 pour l'espace insécable (voir /help "
+"print pour les formats supportés)"
+
+msgid ""
+"comma-separated list of chars (or range of chars) that are considered part "
+"or words for command line; each item can be a single char, a range of chars "
+"(format: a-z), a class of wide character (for example \"alnum\", see man "
+"wctype); a \"!\" before the item makes it negative (ie the char is NOT "
+"considered part of words); the value \"*\" matches any char; unicode chars "
+"are allowed with the format \\u1234, for example \\u00A0 for unbreakable "
+"space (see /help print for supported formats)"
+msgstr ""
+"liste de caractères séparés pas des virgules (ou intervalle de caractères) "
+"qui sont considérés comme faisant partie des mots pour la ligne de "
+"commande ; chaque élément peut être un simple caractère, un intervalle de "
+"caractères (format : a-z), une classe de caractère large (par exemple \"alnum"
+"\", voir man wctype) ; un \"!\" avant un élément le rend négatif (c'est-à-"
+"dire le caractère ne fait PAS partie des mots) ; la valeur \"*\" correspond "
+"à n'importe quel caractère ; les caractères unicode sont autorisés avec le "
+"format \\u1234, par exemple \\u00A0 pour l'espace insécable (voir /help "
+"print pour les formats supportés)"
+
msgid "text color for '+' when scrolling bars"
msgstr "couleur du texte pour les '+' lors du défilement des barres"
diff --git a/po/hu.po b/po/hu.po
index b94e191fa..1b58add41 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: 2015-03-30 19:14+0200\n"
+"POT-Creation-Date: 2015-04-11 18:40+0200\n"
"PO-Revision-Date: 2015-03-21 08:41+0100\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -2934,6 +2934,26 @@ msgstr ""
"ablak címsorának beállítása (Curses GUI esetén a terminálé) a program nevére "
"és verziójára"
+msgid ""
+"comma-separated list of chars (or range of chars) that are considered part "
+"or words for highlights; each item can be a single char, a range of chars "
+"(format: a-z), a class of wide character (for example \"alnum\", see man "
+"wctype); a \"!\" before the item makes it negative (ie the char is NOT "
+"considered part of words); the value \"*\" matches any char; unicode chars "
+"are allowed with the format \\u1234, for example \\u00A0 for unbreakable "
+"space (see /help print for supported formats)"
+msgstr ""
+
+msgid ""
+"comma-separated list of chars (or range of chars) that are considered part "
+"or words for command line; each item can be a single char, a range of chars "
+"(format: a-z), a class of wide character (for example \"alnum\", see man "
+"wctype); a \"!\" before the item makes it negative (ie the char is NOT "
+"considered part of words); the value \"*\" matches any char; unicode chars "
+"are allowed with the format \\u1234, for example \\u00A0 for unbreakable "
+"space (see /help print for supported formats)"
+msgstr ""
+
#, fuzzy
msgid "text color for '+' when scrolling bars"
msgstr "a '+' jel színe téma görgetésekor"
diff --git a/po/it.po b/po/it.po
index 7468cb430..c5511f0a1 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: 2015-03-30 19:14+0200\n"
+"POT-Creation-Date: 2015-04-11 18:40+0200\n"
"PO-Revision-Date: 2015-03-21 08:41+0100\n"
"Last-Translator: Esteban I. Ruiz Moreno <exio4.com@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -3645,6 +3645,26 @@ msgstr ""
"password per il server (nota: il contenuto viene valutato, consultare /help "
"eval)"
+msgid ""
+"comma-separated list of chars (or range of chars) that are considered part "
+"or words for highlights; each item can be a single char, a range of chars "
+"(format: a-z), a class of wide character (for example \"alnum\", see man "
+"wctype); a \"!\" before the item makes it negative (ie the char is NOT "
+"considered part of words); the value \"*\" matches any char; unicode chars "
+"are allowed with the format \\u1234, for example \\u00A0 for unbreakable "
+"space (see /help print for supported formats)"
+msgstr ""
+
+msgid ""
+"comma-separated list of chars (or range of chars) that are considered part "
+"or words for command line; each item can be a single char, a range of chars "
+"(format: a-z), a class of wide character (for example \"alnum\", see man "
+"wctype); a \"!\" before the item makes it negative (ie the char is NOT "
+"considered part of words); the value \"*\" matches any char; unicode chars "
+"are allowed with the format \\u1234, for example \\u00A0 for unbreakable "
+"space (see /help print for supported formats)"
+msgstr ""
+
msgid "text color for '+' when scrolling bars"
msgstr "colore del testo '+' allo scorrimento delle barre"
diff --git a/po/ja.po b/po/ja.po
index beb395117..c7ebe3c4e 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: 2015-03-30 19:14+0200\n"
+"POT-Creation-Date: 2015-04-11 18:40+0200\n"
"PO-Revision-Date: 2015-04-01 23:14+0900\n"
"Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n"
"Language-Team: Japanese <https://github.com/l/weechat/tree/translation_ja>\n"
@@ -40,11 +40,11 @@ msgid "max chars"
msgstr "最大文字数"
msgid ""
-"a WeeChat color name (default, black, (dark)gray, white, (light)red, (light)"
-"green, brown, yellow, (light)blue, (light)magenta, (light)cyan), a terminal "
-"color number or an alias; attributes are allowed before color (for text "
-"color only, not background): \"*\" for bold, \"!\" for reverse, \"/\" for "
-"italic, \"_\" for underline"
+"a WeeChat color name (default, black, (dark)gray, white, (light)red, "
+"(light)green, brown, yellow, (light)blue, (light)magenta, (light)cyan), a "
+"terminal color number or an alias; attributes are allowed before color (for "
+"text color only, not background): \"*\" for bold, \"!\" for reverse, \"/\" "
+"for italic, \"_\" for underline"
msgstr ""
"WeeChat の色名 (default、black、(dark)gray、white、(light)red、(light)green、"
"brown、yellow、(light)blue、(light)magenta、(light)cyan) 、ターミナル色番号ま"
@@ -3704,6 +3704,26 @@ msgstr ""
"合、タイトルは変更されません (注意: 値は評価されます、/help eval を参照してく"
"ださい)"
+msgid ""
+"comma-separated list of chars (or range of chars) that are considered part "
+"or words for highlights; each item can be a single char, a range of chars "
+"(format: a-z), a class of wide character (for example \"alnum\", see man "
+"wctype); a \"!\" before the item makes it negative (ie the char is NOT "
+"considered part of words); the value \"*\" matches any char; unicode chars "
+"are allowed with the format \\u1234, for example \\u00A0 for unbreakable "
+"space (see /help print for supported formats)"
+msgstr ""
+
+msgid ""
+"comma-separated list of chars (or range of chars) that are considered part "
+"or words for command line; each item can be a single char, a range of chars "
+"(format: a-z), a class of wide character (for example \"alnum\", see man "
+"wctype); a \"!\" before the item makes it negative (ie the char is NOT "
+"considered part of words); the value \"*\" matches any char; unicode chars "
+"are allowed with the format \\u1234, for example \\u00A0 for unbreakable "
+"space (see /help print for supported formats)"
+msgstr ""
+
msgid "text color for '+' when scrolling bars"
msgstr "バーをスクロールする際の '+' のテキスト色"
@@ -5986,8 +6006,8 @@ msgstr ""
" - 内部サーバ名 (/server add で作成されたもの、利用推奨)\n"
" - ホスト名/ポート番号又は IP アドレス/ポート番号、デフォルトの"
"ポート番号は 6667\n"
-" - 次のフォーマットに従う URL: irc[6][s]://[nickname[:password]@]"
-"irc.example.org[:port][/#channel1][,#channel2[...]]\n"
+" - 次のフォーマットに従う URL: irc[6][s]://[nickname[:"
+"password]@]irc.example.org[:port][/#channel1][,#channel2[...]]\n"
" 注意: アドレス/IP/URL を指定した場合、サーバを一時的に作ります "
"(保存しません)、/help irc.look.temporary_servers を参照してください。\n"
" option: サーバに関するオプション (ブール型オプションでは、value は無視さ"
@@ -11028,8 +11048,8 @@ msgid ""
"Examples (you can also look at default triggers with /trigger listdefault):\n"
" add text attributes *bold*, _underline_ and /italic/ (only in user "
"messages):\n"
-" /trigger add effects modifier weechat_print \"${tg_tag_nick}\" \"==\\*"
-"(\\S+)\\*==*${color:bold}${re:1}${color:-bold}*== ==_(\\S+)_==_${color:"
+" /trigger add effects modifier weechat_print \"${tg_tag_nick}\" \"=="
+"\\*(\\S+)\\*==*${color:bold}${re:1}${color:-bold}*== ==_(\\S+)_==_${color:"
"underline}${re:1}${color:-underline}_== ==/(\\S+)/==/${color:"
"italic}${re:1}${color:-italic}/\"\n"
" hide nicklist bar on small terminals:\n"
@@ -11105,8 +11125,8 @@ msgstr ""
"\n"
"例 (/trigger listdefault でデフォルトトリガを見ることができます):\n"
" テキスト属性 *太字*、_下線_、/イタリック/ を追加 (ユーザメッセージのみ):\n"
-" /trigger add effects modifier weechat_print \"${tg_tag_nick}\" \"==\\*"
-"(\\S+)\\*==*${color:bold}${re:1}${color:-bold}*== ==_(\\S+)_==_${color:"
+" /trigger add effects modifier weechat_print \"${tg_tag_nick}\" \"=="
+"\\*(\\S+)\\*==*${color:bold}${re:1}${color:-bold}*== ==_(\\S+)_==_${color:"
"underline}${re:1}${color:-underline}_== ==/(\\S+)/==/${color:"
"italic}${re:1}${color:-italic}/\"\n"
" 狭い端末ではニックネームリストバーを隠す:\n"
diff --git a/po/pl.po b/po/pl.po
index abee24d59..6d133948b 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: 2015-03-30 19:14+0200\n"
+"POT-Creation-Date: 2015-04-11 18:40+0200\n"
"PO-Revision-Date: 2015-03-21 08:41+0100\n"
"Last-Translator: Krzysztof Korościk <soltys@szluug.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -3790,6 +3790,26 @@ msgstr ""
"tytuł dla okna (terminal dla GUI Curses), ustawiany na starcie; pusty ciąg "
"pozostawi tytuł bez zmian (zawartość jest przetwarzana, zobacz /help eval)"
+msgid ""
+"comma-separated list of chars (or range of chars) that are considered part "
+"or words for highlights; each item can be a single char, a range of chars "
+"(format: a-z), a class of wide character (for example \"alnum\", see man "
+"wctype); a \"!\" before the item makes it negative (ie the char is NOT "
+"considered part of words); the value \"*\" matches any char; unicode chars "
+"are allowed with the format \\u1234, for example \\u00A0 for unbreakable "
+"space (see /help print for supported formats)"
+msgstr ""
+
+msgid ""
+"comma-separated list of chars (or range of chars) that are considered part "
+"or words for command line; each item can be a single char, a range of chars "
+"(format: a-z), a class of wide character (for example \"alnum\", see man "
+"wctype); a \"!\" before the item makes it negative (ie the char is NOT "
+"considered part of words); the value \"*\" matches any char; unicode chars "
+"are allowed with the format \\u1234, for example \\u00A0 for unbreakable "
+"space (see /help print for supported formats)"
+msgstr ""
+
msgid "text color for '+' when scrolling bars"
msgstr "kolor '+' przy przewijaniu pasków"
diff --git a/po/pt_BR.po b/po/pt_BR.po
index b82be378f..61fd8b8db 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: 2015-03-30 19:14+0200\n"
+"POT-Creation-Date: 2015-04-11 18:40+0200\n"
"PO-Revision-Date: 2015-03-21 08:41+0100\n"
"Last-Translator: Eduardo Elias <camponez@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -3537,6 +3537,26 @@ msgstr ""
"comando executado quando o WeeChat inicia, antes do carregamento dos plugins "
"(nota: conteúdo é avaliado, veja /help eval)"
+msgid ""
+"comma-separated list of chars (or range of chars) that are considered part "
+"or words for highlights; each item can be a single char, a range of chars "
+"(format: a-z), a class of wide character (for example \"alnum\", see man "
+"wctype); a \"!\" before the item makes it negative (ie the char is NOT "
+"considered part of words); the value \"*\" matches any char; unicode chars "
+"are allowed with the format \\u1234, for example \\u00A0 for unbreakable "
+"space (see /help print for supported formats)"
+msgstr ""
+
+msgid ""
+"comma-separated list of chars (or range of chars) that are considered part "
+"or words for command line; each item can be a single char, a range of chars "
+"(format: a-z), a class of wide character (for example \"alnum\", see man "
+"wctype); a \"!\" before the item makes it negative (ie the char is NOT "
+"considered part of words); the value \"*\" matches any char; unicode chars "
+"are allowed with the format \\u1234, for example \\u00A0 for unbreakable "
+"space (see /help print for supported formats)"
+msgstr ""
+
msgid "text color for '+' when scrolling bars"
msgstr "cor de texto para '+' quando estiver rolando barras"
diff --git a/po/ru.po b/po/ru.po
index 3b899ec2b..28b8146a4 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: 2015-03-30 19:14+0200\n"
+"POT-Creation-Date: 2015-04-11 18:40+0200\n"
"PO-Revision-Date: 2015-03-21 08:41+0100\n"
"Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -2964,6 +2964,26 @@ msgstr ""
"устанавливать заголовок окна (терминала при интерфейсе Curses) с именем и "
"версией"
+msgid ""
+"comma-separated list of chars (or range of chars) that are considered part "
+"or words for highlights; each item can be a single char, a range of chars "
+"(format: a-z), a class of wide character (for example \"alnum\", see man "
+"wctype); a \"!\" before the item makes it negative (ie the char is NOT "
+"considered part of words); the value \"*\" matches any char; unicode chars "
+"are allowed with the format \\u1234, for example \\u00A0 for unbreakable "
+"space (see /help print for supported formats)"
+msgstr ""
+
+msgid ""
+"comma-separated list of chars (or range of chars) that are considered part "
+"or words for command line; each item can be a single char, a range of chars "
+"(format: a-z), a class of wide character (for example \"alnum\", see man "
+"wctype); a \"!\" before the item makes it negative (ie the char is NOT "
+"considered part of words); the value \"*\" matches any char; unicode chars "
+"are allowed with the format \\u1234, for example \\u00A0 for unbreakable "
+"space (see /help print for supported formats)"
+msgstr ""
+
#, fuzzy
msgid "text color for '+' when scrolling bars"
msgstr "цвет '+' при прокрутке топика"
diff --git a/po/tr.po b/po/tr.po
index ffebdc6aa..3da801b95 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: 2015-03-30 19:14+0200\n"
+"POT-Creation-Date: 2015-04-11 18:40+0200\n"
"PO-Revision-Date: 2015-03-10 21:33+0100\n"
"Last-Translator: Hasan Kiran <sunder67@hotmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -2662,6 +2662,26 @@ msgid ""
"will keep title unchanged (note: content is evaluated, see /help eval)"
msgstr ""
+msgid ""
+"comma-separated list of chars (or range of chars) that are considered part "
+"or words for highlights; each item can be a single char, a range of chars "
+"(format: a-z), a class of wide character (for example \"alnum\", see man "
+"wctype); a \"!\" before the item makes it negative (ie the char is NOT "
+"considered part of words); the value \"*\" matches any char; unicode chars "
+"are allowed with the format \\u1234, for example \\u00A0 for unbreakable "
+"space (see /help print for supported formats)"
+msgstr ""
+
+msgid ""
+"comma-separated list of chars (or range of chars) that are considered part "
+"or words for command line; each item can be a single char, a range of chars "
+"(format: a-z), a class of wide character (for example \"alnum\", see man "
+"wctype); a \"!\" before the item makes it negative (ie the char is NOT "
+"considered part of words); the value \"*\" matches any char; unicode chars "
+"are allowed with the format \\u1234, for example \\u00A0 for unbreakable "
+"space (see /help print for supported formats)"
+msgstr ""
+
msgid "text color for '+' when scrolling bars"
msgstr ""
diff --git a/po/weechat.pot b/po/weechat.pot
index 3e1427eea..99a9ce38e 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: 2015-03-30 19:14+0200\n"
+"POT-Creation-Date: 2015-04-11 18:40+0200\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"
@@ -2659,6 +2659,26 @@ msgid ""
"will keep title unchanged (note: content is evaluated, see /help eval)"
msgstr ""
+msgid ""
+"comma-separated list of chars (or range of chars) that are considered part "
+"or words for highlights; each item can be a single char, a range of chars "
+"(format: a-z), a class of wide character (for example \"alnum\", see man "
+"wctype); a \"!\" before the item makes it negative (ie the char is NOT "
+"considered part of words); the value \"*\" matches any char; unicode chars "
+"are allowed with the format \\u1234, for example \\u00A0 for unbreakable "
+"space (see /help print for supported formats)"
+msgstr ""
+
+msgid ""
+"comma-separated list of chars (or range of chars) that are considered part "
+"or words for command line; each item can be a single char, a range of chars "
+"(format: a-z), a class of wide character (for example \"alnum\", see man "
+"wctype); a \"!\" before the item makes it negative (ie the char is NOT "
+"considered part of words); the value \"*\" matches any char; unicode chars "
+"are allowed with the format \\u1234, for example \\u00A0 for unbreakable "
+"space (see /help print for supported formats)"
+msgstr ""
+
msgid "text color for '+' when scrolling bars"
msgstr ""
diff --git a/src/core/wee-config.c b/src/core/wee-config.c
index a811c300e..7d3ec8111 100644
--- a/src/core/wee-config.c
+++ b/src/core/wee-config.c
@@ -178,6 +178,8 @@ struct t_config_option *config_look_window_auto_zoom;
struct t_config_option *config_look_window_separator_horizontal;
struct t_config_option *config_look_window_separator_vertical;
struct t_config_option *config_look_window_title;
+struct t_config_option *config_look_word_chars_highlight;
+struct t_config_option *config_look_word_chars_input;
/* config, colors section */
@@ -292,6 +294,10 @@ int config_num_highlight_tags = 0;
char **config_plugin_extensions = NULL;
int config_num_plugin_extensions = 0;
char config_tab_spaces[TAB_MAX_WIDTH + 1];
+struct t_config_look_word_char_item *config_word_chars_highlight = NULL;
+int config_word_chars_highlight_count = 0;
+struct t_config_look_word_char_item *config_word_chars_input = NULL;
+int config_word_chars_input_count = 0;
/*
@@ -382,6 +388,131 @@ config_change_window_title (void *data, struct t_config_option *option)
}
/*
+ * Sets word chars array with a word chars option.
+ */
+
+void
+config_set_word_chars (const char *str_word_chars,
+ struct t_config_look_word_char_item **word_chars,
+ int *word_chars_count)
+{
+ char **items, *item, *item2, *ptr_item, *pos;
+ int i;
+
+ if (*word_chars)
+ {
+ free (*word_chars);
+ *word_chars = NULL;
+ }
+ *word_chars_count = 0;
+
+ if (!str_word_chars || !str_word_chars[0])
+ return;
+
+ items = string_split (str_word_chars, ",", 0, 0, word_chars_count);
+ if (!items)
+ {
+ *word_chars_count = 0;
+ return;
+ }
+ if (*word_chars_count == 0)
+ return;
+
+ *word_chars = malloc (
+ sizeof ((*word_chars)[0]) * (*word_chars_count));
+ if (!*word_chars)
+ return;
+
+ for (i = 0; i < *word_chars_count; i++)
+ {
+ /* init structure */
+ (*word_chars)[i].exclude = 0;
+ (*word_chars)[i].wc_class = (wctype_t)0;
+ (*word_chars)[i].char1 = 0;
+ (*word_chars)[i].char2 = 0;
+
+ ptr_item = items[i];
+ if ((ptr_item[0] == '!') && ptr_item[1])
+ {
+ (*word_chars)[i].exclude = 1;
+ ptr_item++;
+ }
+
+ if (strcmp (ptr_item, "*") != 0)
+ {
+ pos = strchr (ptr_item, '-');
+ if (pos && (pos > ptr_item) && pos[1])
+ {
+ /* range: char1 -> char2 */
+ /* char1 */
+ item = string_strndup (ptr_item, pos - ptr_item);
+ item2 = string_convert_escaped_chars (item);
+ (*word_chars)[i].char1 = utf8_wide_char (item2);
+ if (item)
+ free (item);
+ if (item2)
+ free (item2);
+ /* char2 */
+ item = strdup (pos + 1);
+ item2 = string_convert_escaped_chars (item);
+ (*word_chars)[i].char2 = utf8_wide_char (item2);
+ if (item)
+ free (item);
+ if (item2)
+ free (item2);
+ }
+ else
+ {
+ /* one char or wide character class */
+ (*word_chars)[i].wc_class = wctype (ptr_item);
+ if ((*word_chars)[i].wc_class == (wctype_t)0)
+ {
+ item = string_convert_escaped_chars (ptr_item);
+ (*word_chars)[i].char1 = utf8_wide_char (item);
+ (*word_chars)[i].char2 = (*word_chars)[i].char1;
+ if (item)
+ free (item);
+ }
+ }
+ }
+ }
+
+ string_free_split (items);
+}
+
+/*
+ * Callback for changes on option "weechat.look.word_chars_highlight".
+ */
+
+void
+config_change_word_chars_highlight (void *data, struct t_config_option *option)
+{
+ /* make C compiler happy */
+ (void) data;
+ (void) option;
+
+ config_set_word_chars (CONFIG_STRING(config_look_word_chars_highlight),
+ &config_word_chars_highlight,
+ &config_word_chars_highlight_count);
+}
+
+/*
+ * Callback for changes on option "weechat.look.word_chars_input".
+ */
+
+void
+config_change_word_chars_input (void *data, struct t_config_option *option)
+{
+ /* make C compiler happy */
+ (void) data;
+ (void) option;
+
+ config_set_word_chars (CONFIG_STRING(config_look_word_chars_input),
+ &config_word_chars_input,
+ &config_word_chars_input_count);
+}
+
+/*
* Callback for changes on options that require a refresh of buffers.
*/
@@ -2742,6 +2873,34 @@ config_weechat_init_options ()
"(note: content is evaluated, see /help eval)"),
NULL, 0, 0, "WeeChat ${info:version}", NULL, 0, NULL, NULL,
&config_change_window_title, NULL, NULL, NULL);
+ config_look_word_chars_highlight = config_file_new_option (
+ weechat_config_file, ptr_section,
+ "word_chars_highlight", "string",
+ N_("comma-separated list of chars (or range of chars) that are "
+ "considered part or words for highlights; "
+ "each item can be a single char, a range of chars (format: a-z), "
+ "a class of wide character (for example \"alnum\", "
+ "see man wctype); a \"!\" before the item makes it negative "
+ "(ie the char is NOT considered part of words); the value \"*\" "
+ "matches any char; unicode chars are allowed with the format "
+ "\\u1234, for example \\u00A0 for unbreakable space "
+ "(see /help print for supported formats)"),
+ NULL, 0, 0, "!\\u00A0,-,_,|,alnum", NULL, 0, NULL, NULL,
+ &config_change_word_chars_highlight, NULL, NULL, NULL);
+ config_look_word_chars_input = config_file_new_option (
+ weechat_config_file, ptr_section,
+ "word_chars_input", "string",
+ N_("comma-separated list of chars (or range of chars) that are "
+ "considered part or words for command line; "
+ "each item can be a single char, a range of chars (format: a-z), "
+ "a class of wide character (for example \"alnum\", "
+ "see man wctype); a \"!\" before the item makes it negative "
+ "(ie the char is NOT considered part of words); the value \"*\" "
+ "matches any char; unicode chars are allowed with the format "
+ "\\u1234, for example \\u00A0 for unbreakable space "
+ "(see /help print for supported formats)"),
+ NULL, 0, 0, "!\\u00A0,-,_,|,alnum", NULL, 0, NULL, NULL,
+ &config_change_word_chars_input, NULL, NULL, NULL);
/* palette */
ptr_section = config_file_new_section (weechat_config_file, "palette",
@@ -3525,6 +3684,10 @@ config_weechat_init ()
config_change_highlight_tags (NULL, NULL);
if (!config_plugin_extensions)
config_change_plugin_extension (NULL, NULL);
+ if (!config_word_chars_highlight)
+ config_change_word_chars_highlight (NULL, NULL);
+ if (!config_word_chars_input)
+ config_change_word_chars_input (NULL, NULL);
return rc;
}
@@ -3600,4 +3763,18 @@ config_weechat_free ()
config_plugin_extensions = NULL;
config_num_plugin_extensions = 0;
}
+
+ if (config_word_chars_highlight)
+ {
+ free (config_word_chars_highlight);
+ config_word_chars_highlight = NULL;
+ config_word_chars_highlight_count = 0;
+ }
+
+ if (config_word_chars_input)
+ {
+ free (config_word_chars_input);
+ config_word_chars_input = NULL;
+ config_word_chars_input_count = 0;
+ }
}
diff --git a/src/core/wee-config.h b/src/core/wee-config.h
index f640d8bd8..3daae73a9 100644
--- a/src/core/wee-config.h
+++ b/src/core/wee-config.h
@@ -22,6 +22,7 @@
#define WEECHAT_CONFIG_H 1
#include <regex.h>
+#include <wctype.h>
#include "wee-config-file.h"
struct t_gui_buffer;
@@ -105,6 +106,14 @@ enum t_config_look_save_layout_on_exit
CONFIG_LOOK_SAVE_LAYOUT_ON_EXIT_ALL,
};
+struct t_config_look_word_char_item
+{
+ char exclude; /* 1 if char is NOT a word char */
+ wctype_t wc_class; /* class of wide characters (wctype) */
+ wint_t char1; /* first char of range */
+ wint_t char2; /* second char of range */
+};
+
extern struct t_config_file *weechat_config_file;
extern struct t_config_section *weechat_config_section_color;
extern struct t_config_section *weechat_config_section_proxy;
@@ -215,6 +224,8 @@ extern struct t_config_option *config_look_window_auto_zoom;
extern struct t_config_option *config_look_window_separator_horizontal;
extern struct t_config_option *config_look_window_separator_vertical;
extern struct t_config_option *config_look_window_title;
+extern struct t_config_option *config_look_word_chars_highlight;
+extern struct t_config_option *config_look_word_chars_input;
extern struct t_config_option *config_color_bar_more;
extern struct t_config_option *config_color_chat;
@@ -315,6 +326,10 @@ extern int config_num_highlight_tags;
extern char **config_plugin_extensions;
extern int config_num_plugin_extensions;
extern char config_tab_spaces[];
+extern struct t_config_look_word_char_item *config_word_chars_highlight;
+extern int config_word_chars_highlight_count;
+extern struct t_config_look_word_char_item *config_word_chars_input;
+extern int config_word_chars_input_count;
extern struct t_config_option *config_weechat_debug_get (const char *plugin_name);
extern int config_weechat_debug_set (const char *plugin_name,
diff --git a/src/core/wee-string.c b/src/core/wee-string.c
index 955c716a3..173a0542f 100644
--- a/src/core/wee-string.c
+++ b/src/core/wee-string.c
@@ -747,35 +747,92 @@ string_convert_escaped_chars (const char *string)
/*
* Checks if first char of string is a "word char".
*
+ * The word chars are customizable with options "weechat.look.word_chars_*".
+ *
* Returns:
* 1: first char is a word char
* 0: first char is not a word char
*/
int
-string_is_word_char (const char *string)
+string_is_word_char (const char *string,
+ struct t_config_look_word_char_item *word_chars,
+ int word_chars_count)
{
- wint_t c = utf8_wide_char (string);
+ wint_t c;
+ int i, match;
+
+ c = utf8_wide_char (string);
if (c == WEOF)
return 0;
- if (iswalnum (c))
- return 1;
-
- switch (c)
+ for (i = 0; i < word_chars_count; i++)
{
- case '-':
- case '_':
- case '|':
- return 1;
+ if (word_chars[i].wc_class != (wctype_t)0)
+ {
+ match = iswctype (c, word_chars[i].wc_class);
+ }
+ else
+ {
+ if ((word_chars[i].char1 == 0)
+ && (word_chars[i].char2 == 0))
+ {
+ match = 1;
+ }
+ else
+ {
+ match = ((c >= word_chars[i].char1) &&
+ (c <= word_chars[i].char2));
+ }
+ }
+ if (match)
+ return (word_chars[i].exclude) ? 0 : 1;
}
- /* not a 'word char' */
+ /* not a word char */
return 0;
}
/*
+ * Checks if first char of string is a "word char" (for highlight).
+ *
+ * The word chars for highlights are customizable with option
+ * "weechat.look.word_chars_highlight".
+ *
+ * Returns:
+ * 1: first char is a word char
+ * 0: first char is not a word char
+ */
+
+int
+string_is_word_char_highlight (const char *string)
+{
+ return string_is_word_char (string,
+ config_word_chars_highlight,
+ config_word_chars_highlight_count);
+}
+
+/*
+ * Checks if first char of string is a "word char" (for input).
+ *
+ * The word chars for input are customizable with option
+ * "weechat.look.word_chars_input".
+ *
+ * Returns:
+ * 1: first char is a word char
+ * 0: first char is not a word char
+ */
+
+int
+string_is_word_char_input (const char *string)
+{
+ return string_is_word_char (string,
+ config_word_chars_input,
+ config_word_chars_input_count);
+}
+
+/*
* Converts a mask (string with only "*" as wildcard) to a regex, paying
* attention to special chars in a regex.
*
@@ -1004,8 +1061,8 @@ string_has_highlight (const char *string, const char *highlight_words)
if (!match_pre)
match_pre = match - 1;
match_post = match + length;
- startswith = ((match == msg) || (!string_is_word_char (match_pre)));
- endswith = ((!match_post[0]) || (!string_is_word_char (match_post)));
+ startswith = ((match == msg) || (!string_is_word_char_highlight (match_pre)));
+ endswith = ((!match_post[0]) || (!string_is_word_char_highlight (match_post)));
if ((wildcard_start && wildcard_end) ||
(!wildcard_start && !wildcard_end &&
startswith && endswith) ||
@@ -1063,13 +1120,13 @@ string_has_highlight_regex_compiled (const char *string, regex_t *regex)
if (!startswith)
{
match_pre = utf8_prev_char (string, string + regex_match.rm_so);
- startswith = !string_is_word_char (match_pre);
+ startswith = !string_is_word_char_highlight (match_pre);
}
endswith = 0;
if (startswith)
{
endswith = ((regex_match.rm_eo == (int)strlen (string))
- || !string_is_word_char (string + regex_match.rm_eo));
+ || !string_is_word_char_highlight (string + regex_match.rm_eo));
}
if (startswith && endswith)
return 1;
diff --git a/src/core/wee-string.h b/src/core/wee-string.h
index 4487b263d..683660eed 100644
--- a/src/core/wee-string.h
+++ b/src/core/wee-string.h
@@ -48,7 +48,8 @@ extern char *string_remove_quotes (const char *string, const char *quotes);
extern char *string_strip (const char *string, int left, int right,
const char *chars);
extern char *string_convert_escaped_chars (const char *string);
-extern int string_is_word_char (const char *string);
+extern int string_is_word_char_highlight (const char *string);
+extern int string_is_word_char_input (const char *string);
extern char *string_mask_to_regex (const char *mask);
extern const char *string_regex_flags (const char *regex, int default_flags,
int *flags);
diff --git a/src/gui/gui-input.c b/src/gui/gui-input.c
index 0af19500b..70c0f924a 100644
--- a/src/gui/gui-input.c
+++ b/src/gui/gui-input.c
@@ -814,19 +814,19 @@ gui_input_delete_previous_word (struct t_gui_buffer *buffer)
start = utf8_add_offset (buffer->input_buffer,
buffer->input_buffer_pos - 1);
string = start;
- while (string && (string[0] == ' '))
+ while (string && !string_is_word_char_input (string))
{
string = utf8_prev_char (buffer->input_buffer, string);
}
if (string)
{
- while (string && (string[0] != ' '))
+ while (string && string_is_word_char_input (string))
{
string = utf8_prev_char (buffer->input_buffer, string);
}
if (string)
{
- while (string && (string[0] == ' '))
+ while (string && !string_is_word_char_input (string))
{
string = utf8_prev_char (buffer->input_buffer, string);
}
@@ -875,7 +875,7 @@ gui_input_delete_next_word (struct t_gui_buffer *buffer)
length_deleted = 0;
while (string[0])
{
- if ((string[0] == ' ') && (string > start))
+ if (!string_is_word_char_input (string) && (string > start))
break;
string = utf8_next_char (string);
length_deleted++;
@@ -1087,13 +1087,13 @@ gui_input_move_previous_word (struct t_gui_buffer *buffer)
{
pos = utf8_add_offset (buffer->input_buffer,
buffer->input_buffer_pos - 1);
- while (pos && (pos[0] == ' '))
+ while (pos && !string_is_word_char_input (pos))
{
pos = utf8_prev_char (buffer->input_buffer, pos);
}
if (pos)
{
- while (pos && (pos[0] != ' '))
+ while (pos && string_is_word_char_input (pos))
{
pos = utf8_prev_char (buffer->input_buffer, pos);
}
@@ -1126,13 +1126,13 @@ gui_input_move_next_word (struct t_gui_buffer *buffer)
{
pos = utf8_add_offset (buffer->input_buffer,
buffer->input_buffer_pos);
- while (pos[0] && (pos[0] == ' '))
+ while (pos[0] && !string_is_word_char_input (pos))
{
pos = utf8_next_char (pos);
}
if (pos[0])
{
- while (pos[0] && (pos[0] != ' '))
+ while (pos[0] && string_is_word_char_input (pos))
{
pos = utf8_next_char (pos);
}
diff --git a/tests/unit/core/test-string.cpp b/tests/unit/core/test-string.cpp
index 97f761d47..23533bea4 100644
--- a/tests/unit/core/test-string.cpp
+++ b/tests/unit/core/test-string.cpp
@@ -36,6 +36,9 @@ extern "C"
#define ONE_GB (ONE_MB * 1000ULL)
#define ONE_TB (ONE_GB * 1000ULL)
+#define WEE_IS_WORD_CHAR(__result, __str) \
+ LONGS_EQUAL(__result, string_is_word_char_highlight (__str)); \
+ LONGS_EQUAL(__result, string_is_word_char_input (__str));
#define WEE_HAS_HL_STR(__result, __str, __words) \
LONGS_EQUAL(__result, string_has_highlight (__str, __words));
@@ -415,23 +418,28 @@ TEST(String, ConvertEscapedChars)
/*
* Tests functions:
- * string_is_word_char
+ * string_is_word_char_highlight
+ * string_is_word_char_input
*/
TEST(String, IsWordChar)
{
- LONGS_EQUAL(0, string_is_word_char (NULL));
- LONGS_EQUAL(0, string_is_word_char (""));
- LONGS_EQUAL(0, string_is_word_char ("&abc"));
- LONGS_EQUAL(0, string_is_word_char ("+abc"));
- LONGS_EQUAL(0, string_is_word_char ("$abc"));
- LONGS_EQUAL(0, string_is_word_char ("*abc"));
- LONGS_EQUAL(0, string_is_word_char ("/abc"));
-
- LONGS_EQUAL(1, string_is_word_char ("abc"));
- LONGS_EQUAL(1, string_is_word_char ("-abc"));
- LONGS_EQUAL(1, string_is_word_char ("_abc"));
- LONGS_EQUAL(1, string_is_word_char ("|abc"));
+ WEE_IS_WORD_CHAR(0, NULL);
+ WEE_IS_WORD_CHAR(0, "");
+ WEE_IS_WORD_CHAR(0, " abc"); /* space */
+ WEE_IS_WORD_CHAR(0, "\u00A0abc"); /* unbreakable space */
+ WEE_IS_WORD_CHAR(0, "&abc");
+ WEE_IS_WORD_CHAR(0, "+abc");
+ WEE_IS_WORD_CHAR(0, "$abc");
+ WEE_IS_WORD_CHAR(0, "*abc");
+ WEE_IS_WORD_CHAR(0, "/abc");
+ WEE_IS_WORD_CHAR(0, "\\abc");
+
+ WEE_IS_WORD_CHAR(1, "abc");
+ WEE_IS_WORD_CHAR(1, "1abc");
+ WEE_IS_WORD_CHAR(1, "-abc");
+ WEE_IS_WORD_CHAR(1, "_abc");
+ WEE_IS_WORD_CHAR(1, "|abc");
}
/*
@@ -531,11 +539,16 @@ TEST(String, Highlight)
WEE_HAS_HL_STR(0, "", "");
WEE_HAS_HL_STR(0, "test", "");
WEE_HAS_HL_STR(0, "", "test");
+ WEE_HAS_HL_STR(0, "test-here", "test");
+ WEE_HAS_HL_STR(0, "this is a test here", "abc,def");
WEE_HAS_HL_STR(1, "test", "test");
WEE_HAS_HL_STR(1, "this is a test", "test");
WEE_HAS_HL_STR(1, "test here", "test");
+ WEE_HAS_HL_STR(1, "test: here", "test");
+ WEE_HAS_HL_STR(1, "test : here", "test");
+ WEE_HAS_HL_STR(1, "test\u00A0here", "test"); /* unbreakable space */
+ WEE_HAS_HL_STR(1, "test\u00A0:here", "test"); /* unbreakable space */
WEE_HAS_HL_STR(1, "this is a test here", "test");
- WEE_HAS_HL_STR(0, "this is a test here", "abc,def");
WEE_HAS_HL_STR(1, "this is a test here", "abc,test");
/*