aspell: add bar item "aspell_suggest": suggestions for misspelled word at cursor (task #12061) (patch from Nils Görs)

This commit is contained in:
Sebastien Helleu 2012-11-04 11:50:15 +01:00
parent 9e94bfd48b
commit 57d5afeda5
27 changed files with 462 additions and 57 deletions

View File

@ -22,7 +22,8 @@ Version 0.4.0 (under dev!)
shuffle list of hosts for a same address, add argument "retry" for
hook_connect, move "sock" from hook_connect arguments to callback of
hook_connect (task #11205)
* aspell: add bar item "aspell_dict" (dictionary used on current buffer)
* aspell: add bar items "aspell_dict" (dictionary used on current buffer) and
"aspell_suggest" (suggestions for misspelled word at cursor) (task #12061)
* aspell: fix creation of spellers when number of dictionaries is different
between two buffers
* irc: add command /quiet, fix display of messages 728/729 (quiet list, end of

View File

@ -23,6 +23,11 @@
** Typ: boolesch
** Werte: on, off (Standardwert: `off`)
* [[option_aspell.check.suggestions]] *aspell.check.suggestions*
** Beschreibung: `number of suggestions to display in bar item "aspell_suggest" for each dictionary set in buffer (-1 = disable suggestions, 0 = display all possible suggestions in all languages)`
** Typ: integer
** Werte: -1 .. 2147483647 (Standardwert: `-1`)
* [[option_aspell.check.word_min_length]] *aspell.check.word_min_length*
** Beschreibung: `Mindestlänge für ein Wort, welches auf Rechtschreibung überprüft werden soll (bei 0 werden alle Wörter überprüft)`
** Typ: integer

View File

@ -47,7 +47,6 @@ Um WeeChat zu installieren wird folgendes benötigt:
* 'root' Privilegien (um WeeChat im Systemverzeichnis zu installieren)
* ncurses Bibliothek
[[install]]
Installation
------------
@ -302,7 +301,6 @@ Sollte WeeChat abgestürzt sein, muss der Befehl `bt full` genutzt werden:
(gdb) bt full
----------------------------------------
[[usage]]
Nutzung
-------
@ -1409,7 +1407,6 @@ WeeChat Befehle
include::autogen/user/weechat_commands.txt[]
[[plugins]]
Erweiterungen
-------------
@ -1521,6 +1518,33 @@ Um zum Beispiel die Option "ignore-case" einzuschalten:
/set aspell.option.ignore-case "true"
----------------------------------------
// TRANSLATION MISSING
[[aspell_suggestions]]
Suggestions
^^^^^^^^^^^
Suggestions are displayed in a bar item called "aspell_suggest". The number of
suggestions is set in option 'aspell.check.suggestions'.
To enable suggestions you must set option 'aspell.check.suggestions' to an
integer ≥ 0 and add the bar item "aspell_suggest" to a bar, like 'status'.
Example of suggestions with english dictionary (`en`):
........................................
│[12:55] [6] [irc/freenode] 3:#test(+n){4} [print,prone,prune] │
│[@Flashy] prinr █ │
└─────────────────────────────────────────────────────────────────────────────────┘
........................................
Exemple of suggestions with english and french dictionaries (`en,fr`):
........................................
│[12:55] [6] [irc/freenode] 3:#test(+n){4} [print,prone,prune/prime,primer,primé] │
│[@Flashy] prinr █ │
└─────────────────────────────────────────────────────────────────────────────────┘
........................................
[[charset_plugin]]
Charset Erweiterung
~~~~~~~~~~~~~~~~~~~
@ -2515,7 +2539,6 @@ Befehle
include::autogen/user/xfer_commands.txt[]
[[authors]]
Autoren
-------
@ -2546,7 +2569,6 @@ Patches::
Quentin Glidic (SardemFF7), Simon Kuhnle, Mateusz Poszwa, Peter Boström,
Arvydas Sidorenko, Simon Arlott
[[support]]
Unterstützung
-------------

View File

@ -23,6 +23,11 @@
** type: boolean
** values: on, off (default value: `off`)
* [[option_aspell.check.suggestions]] *aspell.check.suggestions*
** description: `number of suggestions to display in bar item "aspell_suggest" for each dictionary set in buffer (-1 = disable suggestions, 0 = display all possible suggestions in all languages)`
** type: integer
** values: -1 .. 2147483647 (default value: `-1`)
* [[option_aspell.check.word_min_length]] *aspell.check.word_min_length*
** description: `minimum length for a word to be spell checked (use 0 to check all words)`
** type: integer

View File

@ -47,7 +47,6 @@ In order to install WeeChat, you need:
* 'root' privileges (to install WeeChat in a system directory)
* ncurses library
[[install]]
Installation
------------
@ -303,7 +302,6 @@ Then like for a crash, use command `bt full`:
(gdb) bt full
----------------------------------------
[[usage]]
Usage
-----
@ -1390,7 +1388,6 @@ WeeChat commands
include::autogen/user/weechat_commands.txt[]
[[plugins]]
Plugins
-------
@ -1502,6 +1499,31 @@ For example, to enable option "ignore-case":
/set aspell.option.ignore-case "true"
----------------------------------------
[[aspell_suggestions]]
Suggestions
^^^^^^^^^^^
Suggestions are displayed in a bar item called "aspell_suggest". The number of
suggestions is set in option 'aspell.check.suggestions'.
To enable suggestions you must set option 'aspell.check.suggestions' to an
integer ≥ 0 and add the bar item "aspell_suggest" to a bar, like 'status'.
Example of suggestions with english dictionary (`en`):
........................................
│[12:55] [6] [irc/freenode] 3:#test(+n){4} [print,prone,prune] │
│[@Flashy] prinr █ │
└─────────────────────────────────────────────────────────────────────────────────┘
........................................
Exemple of suggestions with english and french dictionaries (`en,fr`):
........................................
│[12:55] [6] [irc/freenode] 3:#test(+n){4} [print,prone,prune/prime,primer,primé] │
│[@Flashy] prinr █ │
└─────────────────────────────────────────────────────────────────────────────────┘
........................................
[[charset_plugin]]
Charset plugin
@ -2470,7 +2492,6 @@ Commands
include::autogen/user/xfer_commands.txt[]
[[authors]]
Authors
-------
@ -2501,7 +2522,6 @@ Patches::
Quentin Glidic (SardemFF7), Simon Kuhnle, Mateusz Poszwa, Peter Boström,
Arvydas Sidorenko, Simon Arlott
[[support]]
Support
-------

View File

@ -23,6 +23,11 @@
** type: booléen
** valeurs: on, off (valeur par défaut: `off`)
* [[option_aspell.check.suggestions]] *aspell.check.suggestions*
** description: `nombre de suggestions à afficher dans l'objet de barre "aspell_suggest" pour chaque dictionnaire du tampon (-1 = désactiver les suggestions, 0 = afficher toutes les suggestions possibles dans toutes les langues)`
** type: entier
** valeurs: -1 .. 2147483647 (valeur par défaut: `-1`)
* [[option_aspell.check.word_min_length]] *aspell.check.word_min_length*
** description: `longueur minimum d'un mot pour que l'otrhographe soit vérifiée (utilisez 0 pour vérifier tous les mots)`
** type: entier

View File

@ -48,7 +48,6 @@ Pour installer WeeChat, vous devez avoir :
* droits "root" (pour installer WeeChat dans un répertoire système)
* la bibliothèque ncurses
[[install]]
Installation
------------
@ -310,7 +309,6 @@ Ensuite comme pour un crash, utilisez la commande `bt full` :
(gdb) bt full
----------------------------------------
[[usage]]
Utilisation
-----------
@ -1430,7 +1428,6 @@ Commandes WeeChat
include::autogen/user/weechat_commands.txt[]
[[plugins]]
Extensions
----------
@ -1544,6 +1541,33 @@ Par exemple, pour activer l'option "ignore-case":
/set aspell.option.ignore-case "true"
----------------------------------------
[[aspell_suggestions]]
Suggestions
^^^^^^^^^^^
Les suggestions sont affichées dans un objet de barre appelé "aspell_suggest".
Le nombre de suggestions est défini dans l'option 'aspell.check.suggestions'.
Pour activer les suggestions, vous devez modifier l'option
'aspell.check.suggestions' avec un entier ≥ 0 et ajouter l'objet de barre
"aspell_suggest" à une barre, par exemple 'status'.
Exemple de suggestions avec un dictionnaire anglais (`en`) :
........................................
│[12:55] [6] [irc/freenode] 3:#test(+n){4} [print,prone,prune] │
│[@Flashy] prinr █ │
└─────────────────────────────────────────────────────────────────────────────────┘
........................................
Exemple de suggestions avec des dictionnaires anglais et français (`en,fr`) :
........................................
│[12:55] [6] [irc/freenode] 3:#test(+n){4} [print,prone,prune/prime,primer,primé] │
│[@Flashy] prinr █ │
└─────────────────────────────────────────────────────────────────────────────────┘
........................................
[[charset_plugin]]
Extension Charset
~~~~~~~~~~~~~~~~~
@ -2546,7 +2570,6 @@ Commandes
include::autogen/user/xfer_commands.txt[]
[[authors]]
Auteurs
-------
@ -2577,7 +2600,6 @@ Patchs::
Quentin Glidic (SardemFF7), Simon Kuhnle, Mateusz Poszwa, Peter Boström,
Arvydas Sidorenko, Simon Arlott
[[support]]
Support
-------

View File

@ -23,6 +23,11 @@
** tipo: bool
** valori: on, off (valore predefinito: `off`)
* [[option_aspell.check.suggestions]] *aspell.check.suggestions*
** descrizione: `number of suggestions to display in bar item "aspell_suggest" for each dictionary set in buffer (-1 = disable suggestions, 0 = display all possible suggestions in all languages)`
** tipo: intero
** valori: -1 .. 2147483647 (valore predefinito: `-1`)
* [[option_aspell.check.word_min_length]] *aspell.check.word_min_length*
** descrizione: `lunghezza minima per una parola da controllare (0 per controllarle tutte)`
** tipo: intero

View File

@ -49,7 +49,6 @@ Per poter installare WeeChat, è necessario:
sistema)
* librerie ncurses
[[install]]
Installazione
-------------
@ -316,7 +315,6 @@ Poi, come per un crash, usare il comando `bt full`:
(gdb) bt full
----------------------------------------
[[usage]]
Utilizzo
--------
@ -1421,7 +1419,6 @@ Comandi di WeeChat
include::autogen/user/weechat_commands.txt[]
[[plugins]]
Plugin
------
@ -1534,6 +1531,33 @@ Ad esempio, per abilitare l'opzione "ignore-case":
/set aspell.option.ignore-case "true"
----------------------------------------
// TRANSLATION MISSING
[[aspell_suggestions]]
Suggestions
^^^^^^^^^^^
Suggestions are displayed in a bar item called "aspell_suggest". The number of
suggestions is set in option 'aspell.check.suggestions'.
To enable suggestions you must set option 'aspell.check.suggestions' to an
integer ≥ 0 and add the bar item "aspell_suggest" to a bar, like 'status'.
Example of suggestions with english dictionary (`en`):
........................................
│[12:55] [6] [irc/freenode] 3:#test(+n){4} [print,prone,prune] │
│[@Flashy] prinr █ │
└─────────────────────────────────────────────────────────────────────────────────┘
........................................
Exemple of suggestions with english and french dictionaries (`en,fr`):
........................................
│[12:55] [6] [irc/freenode] 3:#test(+n){4} [print,prone,prune/prime,primer,primé] │
│[@Flashy] prinr █ │
└─────────────────────────────────────────────────────────────────────────────────┘
........................................
[[charset_plugin]]
Plugin Charset
~~~~~~~~~~~~~~
@ -2532,7 +2556,6 @@ Comandi
include::autogen/user/xfer_commands.txt[]
[[authors]]
Autori
------
@ -2563,7 +2586,6 @@ Patch::
Quentin Glidic (SardemFF7), Simon Kuhnle, Mateusz Poszwa, Peter Boström,
Arvydas Sidorenko, Simon Arlott
[[support]]
Supporto
--------

View File

@ -23,6 +23,11 @@
** タイプ: ブール
** 値: on, off (デフォルト値: `off`)
* [[option_aspell.check.suggestions]] *aspell.check.suggestions*
** 説明: `number of suggestions to display in bar item "aspell_suggest" for each dictionary set in buffer (-1 = disable suggestions, 0 = display all possible suggestions in all languages)`
** タイプ: 整数
** 値: -1 .. 2147483647 (デフォルト値: `-1`)
* [[option_aspell.check.word_min_length]] *aspell.check.word_min_length*
** 説明: `スペルチェックを行う単語長の最小値 (0 の場合は全ての単語をチェック)`
** タイプ: 整数

View File

@ -43,7 +43,6 @@ WeeChat をインストールするには、以下のものが必要です:
* 'root' 特権 (WeeChat をシステムディレクトリにインストールする場合)
* ncurses ライブラリ
[[install]]
== インストール方法 ==
@ -287,7 +286,6 @@ gdb /usr/bin/weechat-curses 12345
(gdb) bt full
----------------------------------------
[[usage]]
== 使い方 ==
@ -1352,7 +1350,6 @@ include::autogen/user/weechat_options.txt[]
include::autogen/user/weechat_commands.txt[]
[[plugins]]
== プラグイン ==
@ -1456,6 +1453,32 @@ $ aspell config
/set aspell.option.ignore-case "true"
----------------------------------------
// TRANSLATION MISSING
[[aspell_suggestions]]
Suggestions
^^^^^^^^^^^
Suggestions are displayed in a bar item called "aspell_suggest". The number of
suggestions is set in option 'aspell.check.suggestions'.
To enable suggestions you must set option 'aspell.check.suggestions' to an
integer ≥ 0 and add the bar item "aspell_suggest" to a bar, like 'status'.
Example of suggestions with english dictionary (`en`):
........................................
│[12:55] [6] [irc/freenode] 3:#test(+n){4} [print,prone,prune] │
│[@Flashy] prinr █ │
└─────────────────────────────────────────────────────────────────────────────────┘
........................................
Exemple of suggestions with english and french dictionaries (`en,fr`):
........................................
│[12:55] [6] [irc/freenode] 3:#test(+n){4} [print,prone,prune/prime,primer,primé] │
│[@Flashy] prinr █ │
└─────────────────────────────────────────────────────────────────────────────────┘
........................................
[[charset_plugin]]
=== Charset プラグイン ===
@ -2379,7 +2402,6 @@ include::autogen/user/xfer_options.txt[]
include::autogen/user/xfer_commands.txt[]
[[authors]]
== 作者 ==
@ -2407,7 +2429,6 @@ include::autogen/user/xfer_commands.txt[]
Quentin Glidic (SardemFF7)、Simon Kuhnle、Mateusz Poszwa、Peter Boström、
Arvydas Sidorenko、Simon Arlott
[[support]]
== サポート ==

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.0-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2012-11-02 18:08+0100\n"
"POT-Creation-Date: 2012-11-04 11:49+0100\n"
"PO-Revision-Date: 2012-09-29 11:42+0200\n"
"Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -3876,6 +3876,12 @@ msgstr ""
"kontrola slov v reálném čase (pomalejší, defaultně vypnuto: slova jsou "
"kontrolovány až, když je za nimi dělič)"
msgid ""
"number of suggestions to display in bar item \"aspell_suggest\" for each "
"dictionary set in buffer (-1 = disable suggestions, 0 = display all possible "
"suggestions in all languages)"
msgstr ""
msgid ""
"minimum length for a word to be spell checked (use 0 to check all words)"
msgstr ""

View File

@ -23,7 +23,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.7-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2012-11-02 18:08+0100\n"
"POT-Creation-Date: 2012-11-04 11:49+0100\n"
"PO-Revision-Date: 2012-10-19 17:57+0100\n"
"Last-Translator: Nils Görs <weechatter@arcor.de>\n"
"Language-Team: German <weechatter@arcor.de>\n"
@ -4272,6 +4272,12 @@ msgstr ""
"ist diese Funktion standardmäßig deaktiviert. Wörter werden erst überprüft "
"sobald ein Leerzeichen dem vorangegangenen Wort folgt)"
msgid ""
"number of suggestions to display in bar item \"aspell_suggest\" for each "
"dictionary set in buffer (-1 = disable suggestions, 0 = display all possible "
"suggestions in all languages)"
msgstr ""
msgid ""
"minimum length for a word to be spell checked (use 0 to check all words)"
msgstr ""

View File

@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.0-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2012-11-02 18:08+0100\n"
"POT-Creation-Date: 2012-11-04 11:49+0100\n"
"PO-Revision-Date: 2012-09-29 11:42+0200\n"
"Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -4073,6 +4073,12 @@ msgstr ""
"verificación ortográfica en tiempo-real (más lento, desactivado por defecto: "
"las palabras son verificadas solo si hay un delimitador después)"
msgid ""
"number of suggestions to display in bar item \"aspell_suggest\" for each "
"dictionary set in buffer (-1 = disable suggestions, 0 = display all possible "
"suggestions in all languages)"
msgstr ""
msgid ""
"minimum length for a word to be spell checked (use 0 to check all words)"
msgstr ""

View File

@ -21,8 +21,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.0-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2012-11-02 18:08+0100\n"
"PO-Revision-Date: 2012-11-02 18:04+0100\n"
"POT-Creation-Date: 2012-11-04 11:49+0100\n"
"PO-Revision-Date: 2012-11-04 10:55+0100\n"
"Last-Translator: Sebastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: French\n"
@ -4207,6 +4207,15 @@ msgstr ""
"vérification orthographique des mots en temps réel (plus lent, désactivé par "
"défaut: les mots sont vérifiés seulement s'il y a un délimiteur après)"
msgid ""
"number of suggestions to display in bar item \"aspell_suggest\" for each "
"dictionary set in buffer (-1 = disable suggestions, 0 = display all possible "
"suggestions in all languages)"
msgstr ""
"nombre de suggestions à afficher dans l'objet de barre \"aspell_suggest\" "
"pour chaque dictionnaire du tampon (-1 = désactiver les suggestions, 0 = "
"afficher toutes les suggestions possibles dans toutes les langues)"
msgid ""
"minimum length for a word to be spell checked (use 0 to check all words)"
msgstr ""

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.0-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2012-11-02 18:08+0100\n"
"POT-Creation-Date: 2012-11-04 11:49+0100\n"
"PO-Revision-Date: 2012-09-29 11:42+0200\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -3505,6 +3505,12 @@ msgid ""
"checked only if there's delimiter after)"
msgstr ""
msgid ""
"number of suggestions to display in bar item \"aspell_suggest\" for each "
"dictionary set in buffer (-1 = disable suggestions, 0 = display all possible "
"suggestions in all languages)"
msgstr ""
msgid ""
"minimum length for a word to be spell checked (use 0 to check all words)"
msgstr ""

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.0-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2012-11-02 18:08+0100\n"
"POT-Creation-Date: 2012-11-04 11:49+0100\n"
"PO-Revision-Date: 2012-09-29 11:42+0200\n"
"Last-Translator: Marco Paolone <marcopaolone@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -4063,6 +4063,12 @@ msgstr ""
"controllo ortografico in tempo reale (più lento, disabilitato per default: "
"le parole vengono controllate solo se seguite da un delimitatore)"
msgid ""
"number of suggestions to display in bar item \"aspell_suggest\" for each "
"dictionary set in buffer (-1 = disable suggestions, 0 = display all possible "
"suggestions in all languages)"
msgstr ""
msgid ""
"minimum length for a word to be spell checked (use 0 to check all words)"
msgstr ""

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.0-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2012-11-02 18:08+0100\n"
"POT-Creation-Date: 2012-11-04 11:49+0100\n"
"PO-Revision-Date: 2012-09-29 11:42+0200\n"
"Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n"
"Language-Team: Japanese <https://github.com/l/WeeChat>\n"
@ -3974,6 +3974,12 @@ msgstr ""
"単語のリアルタイムスペルチェック (遅い、デフォルトでは無効: 単語は区切りの後"
"にだけチェックされる)"
msgid ""
"number of suggestions to display in bar item \"aspell_suggest\" for each "
"dictionary set in buffer (-1 = disable suggestions, 0 = display all possible "
"suggestions in all languages)"
msgstr ""
msgid ""
"minimum length for a word to be spell checked (use 0 to check all words)"
msgstr "スペルチェックを行う単語長の最小値 (0 の場合は全ての単語をチェック)"

View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.0-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2012-11-02 18:08+0100\n"
"POT-Creation-Date: 2012-11-04 11:49+0100\n"
"PO-Revision-Date: 2012-09-29 11:42+0200\n"
"Last-Translator: Krzysztof Korościk <soltys@szluug.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -4054,6 +4054,12 @@ msgstr ""
"sprawdzanie pisowni w czasie rzeczywistym (wolniejsze, wyłączone domyślnie: "
"słowa są sprawdzane tylko jeśli za nimi znajduje się separator)"
msgid ""
"number of suggestions to display in bar item \"aspell_suggest\" for each "
"dictionary set in buffer (-1 = disable suggestions, 0 = display all possible "
"suggestions in all languages)"
msgstr ""
msgid ""
"minimum length for a word to be spell checked (use 0 to check all words)"
msgstr ""

View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.0-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2012-11-02 18:08+0100\n"
"POT-Creation-Date: 2012-11-04 11:49+0100\n"
"PO-Revision-Date: 2012-09-29 11:43+0200\n"
"Last-Translator: Sergio Durigan Junior <sergiosdj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -3930,6 +3930,12 @@ msgstr ""
"verificação ortográfica de palavras em tempo real (mais lento, desabilitado "
"por padrão: palavras são verificadas somente se houver um demilitador depois)"
msgid ""
"number of suggestions to display in bar item \"aspell_suggest\" for each "
"dictionary set in buffer (-1 = disable suggestions, 0 = display all possible "
"suggestions in all languages)"
msgstr ""
msgid ""
"minimum length for a word to be spell checked (use 0 to check all words)"
msgstr ""

View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.0-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2012-11-02 18:08+0100\n"
"POT-Creation-Date: 2012-11-04 11:49+0100\n"
"PO-Revision-Date: 2012-09-29 11:43+0200\n"
"Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -3535,6 +3535,12 @@ msgid ""
"checked only if there's delimiter after)"
msgstr ""
msgid ""
"number of suggestions to display in bar item \"aspell_suggest\" for each "
"dictionary set in buffer (-1 = disable suggestions, 0 = display all possible "
"suggestions in all languages)"
msgstr ""
msgid ""
"minimum length for a word to be spell checked (use 0 to check all words)"
msgstr ""

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2012-11-02 18:08+0100\n"
"POT-Creation-Date: 2012-11-04 11:49+0100\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"
@ -3104,6 +3104,12 @@ msgid ""
"checked only if there's delimiter after)"
msgstr ""
msgid ""
"number of suggestions to display in bar item \"aspell_suggest\" for each "
"dictionary set in buffer (-1 = disable suggestions, 0 = display all possible "
"suggestions in all languages)"
msgstr ""
msgid ""
"minimum length for a word to be spell checked (use 0 to check all words)"
msgstr ""

View File

@ -50,13 +50,53 @@ weechat_aspell_bar_item_dict (void *data, struct t_gui_bar_item *item,
window = weechat_current_window ();
buffer = weechat_window_get_pointer (window, "buffer");
if (buffer)
{
dict_list = weechat_aspell_get_dict (buffer);
if (dict_list)
return strdup (dict_list);
}
return NULL;
}
/*
* weechat_aspell_bar_item_suggest: bar item with aspell suggestions
*/
char *
weechat_aspell_bar_item_suggest (void *data, struct t_gui_bar_item *item,
struct t_gui_window *window)
{
struct t_gui_buffer *buffer;
const char *suggestions;
char str_delim[128], *suggestions2;
/* make C compiler happy */
(void) data;
(void) item;
if (!window)
window = weechat_current_window ();
buffer = weechat_window_get_pointer (window, "buffer");
if (buffer)
{
suggestions = weechat_buffer_get_string (buffer,
"localvar_aspell_suggest");
if (suggestions)
{
snprintf (str_delim, sizeof (str_delim),
"%s/%s",
weechat_color ("bar_delim"),
weechat_color ("bar_fg"));
suggestions2 = weechat_string_replace (suggestions, "/", str_delim);
if (suggestions2)
return suggestions2;
return strdup (suggestions);
}
}
return NULL;
}
@ -68,4 +108,5 @@ void
weechat_aspell_bar_item_init ()
{
weechat_bar_item_new ("aspell_dict", &weechat_aspell_bar_item_dict, NULL);
weechat_bar_item_new ("aspell_suggest", &weechat_aspell_bar_item_suggest, NULL);
}

View File

@ -46,6 +46,7 @@ struct t_config_option *weechat_aspell_config_check_default_dict;
struct t_config_option *weechat_aspell_config_check_during_search;
struct t_config_option *weechat_aspell_config_check_enabled;
struct t_config_option *weechat_aspell_config_check_real_time;
struct t_config_option *weechat_aspell_config_check_suggestions;
struct t_config_option *weechat_aspell_config_check_word_min_length;
@ -132,6 +133,22 @@ weechat_aspell_config_change_enabled (void *data, struct t_config_option *option
weechat_bar_item_update ("input_text");
}
/*
* weechat_aspell_config_change_suggestions: called when number of suggestions
* is changed
*/
void
weechat_aspell_config_change_suggestions (void *data,
struct t_config_option *option)
{
/* make C compiler happy */
(void) data;
(void) option;
weechat_bar_item_update ("aspell_suggest");
}
/*
* weechat_aspell_config_dict_change: called when a dictionary is changed
*/
@ -452,6 +469,14 @@ weechat_aspell_config_init ()
N_("real-time spell checking of words (slower, disabled by default: "
"words are checked only if there's delimiter after)"),
NULL, 0, 0, "off", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
weechat_aspell_config_check_suggestions = weechat_config_new_option (
weechat_aspell_config_file, ptr_section,
"suggestions", "integer",
N_("number of suggestions to display in bar item \"aspell_suggest\" "
"for each dictionary set in buffer (-1 = disable suggestions, "
"0 = display all possible suggestions in all languages)"),
NULL, -1, INT_MAX, "-1", NULL, 0,
NULL, NULL, &weechat_aspell_config_change_suggestions, NULL, NULL, NULL);
weechat_aspell_config_check_word_min_length = weechat_config_new_option (
weechat_aspell_config_file, ptr_section,
"word_min_length", "integer",

View File

@ -31,6 +31,7 @@ extern struct t_config_option *weechat_aspell_config_check_default_dict;
extern struct t_config_option *weechat_aspell_config_check_during_search;
extern struct t_config_option *weechat_aspell_config_check_enabled;
extern struct t_config_option *weechat_aspell_config_check_real_time;
extern struct t_config_option *weechat_aspell_config_check_suggestions;
extern struct t_config_option *weechat_aspell_config_check_word_min_length;
extern char **weechat_aspell_commands_to_check;

View File

@ -44,7 +44,7 @@ weechat_aspell_speller_exists (const char *lang)
{
struct AspellConfig *config;
AspellDictInfoList *list;
AspellDictInfoEnumeration *el;
AspellDictInfoEnumeration *elements;
const AspellDictInfo *dict;
int rc;
@ -52,9 +52,9 @@ weechat_aspell_speller_exists (const char *lang)
config = new_aspell_config ();
list = get_aspell_dict_info_list (config);
el = aspell_dict_info_list_elements (list);
elements = aspell_dict_info_list_elements (list);
while ((dict = aspell_dict_info_enumeration_next (el)))
while ((dict = aspell_dict_info_enumeration_next (elements)) != NULL)
{
if (strcmp (dict->name, lang) == 0)
{
@ -63,7 +63,7 @@ weechat_aspell_speller_exists (const char *lang)
}
}
delete_aspell_dict_info_enumeration (el);
delete_aspell_dict_info_enumeration (elements);
delete_aspell_config (config);
return rc;

View File

@ -49,6 +49,7 @@ int aspell_enabled = 0;
struct t_gui_buffer *aspell_buffer_spellers = NULL;
char *aspell_last_modifier_string = NULL; /* last str. received by modifier */
int aspell_last_buffer_input_pos = -1; /* last cursor position */
char *aspell_last_modifier_result = NULL; /* last str. built by modifier */
/*
@ -385,7 +386,6 @@ weechat_aspell_iso_to_lang (const char *code)
return strdup ("Unknown");
}
/*
* weechat_aspell_iso_to_country: convert an aspell iso country code in its
* english full name
@ -418,12 +418,12 @@ weechat_aspell_speller_list_dicts ()
char buffer[192];
struct AspellConfig *config;
AspellDictInfoList *list;
AspellDictInfoEnumeration *el;
AspellDictInfoEnumeration *elements;
const AspellDictInfo *dict;
config = new_aspell_config();
list = get_aspell_dict_info_list (config);
el = aspell_dict_info_list_elements (list);
elements = aspell_dict_info_list_elements (list);
weechat_printf (NULL, "");
weechat_printf (NULL,
@ -431,7 +431,7 @@ weechat_aspell_speller_list_dicts ()
_( "%s dictionaries list:"),
ASPELL_PLUGIN_NAME);
while ((dict = aspell_dict_info_enumeration_next (el)))
while ((dict = aspell_dict_info_enumeration_next (elements)) != NULL)
{
country = NULL;
pos = strchr (dict->code, '_');
@ -481,7 +481,7 @@ weechat_aspell_speller_list_dicts ()
free (country);
}
delete_aspell_dict_info_enumeration (el);
delete_aspell_dict_info_enumeration (elements);
delete_aspell_config (config);
}
@ -617,7 +617,6 @@ weechat_aspell_check_word (struct t_gui_buffer *buffer, const char *word)
{
struct t_aspell_speller *ptr_speller;
int rc;
rc = 0;
/* word too small? then do not check word */
@ -653,6 +652,74 @@ weechat_aspell_check_word (struct t_gui_buffer *buffer, const char *word)
return rc;
}
/*
* weechat_aspell_get_suggestions: get suggestions for a word
* A string is returned with format:
* "suggest1,suggest2,suggest3"
* Note: result (if not NULL) must be free()
* after use.
*/
char *
weechat_aspell_get_suggestions (const char *word)
{
struct t_aspell_speller *ptr_speller;
int size, max_suggestions, num_suggestions;
char *suggestions, *suggestions2;
const char *ptr_word;
const AspellWordList *list;
AspellStringEnumeration *elements;
max_suggestions = weechat_config_integer (weechat_aspell_config_check_suggestions);
if (max_suggestions < 0)
return NULL;
size = 1;
suggestions = malloc (size);
if (!suggestions)
return NULL;
suggestions[0] = '\0';
for (ptr_speller = weechat_aspell_spellers; ptr_speller;
ptr_speller = ptr_speller->next_speller)
{
list = aspell_speller_suggest (ptr_speller->speller, word, -1);
if (list)
{
elements = aspell_word_list_elements (list);
num_suggestions = 0;
while ((ptr_word = aspell_string_enumeration_next (elements)) != NULL)
{
size += strlen (ptr_word) + ((suggestions[0]) ? 1 : 0);
suggestions2 = realloc (suggestions, size);
if (!suggestions2)
{
free (suggestions);
delete_aspell_string_enumeration (elements);
return NULL;
}
suggestions = suggestions2;
if (suggestions[0])
strcat (suggestions, (num_suggestions == 0) ? "/" : ",");
strcat (suggestions, ptr_word);
num_suggestions++;
if ((max_suggestions >= 0) && (num_suggestions == max_suggestions))
break;
}
delete_aspell_string_enumeration (elements);
}
}
/* no suggestions found */
if (!suggestions[0])
{
free (suggestions);
return NULL;
}
return suggestions;
}
/*
* weechat_aspell_modifier_cb: modifier for input text
*/
@ -664,10 +731,12 @@ weechat_aspell_modifier_cb (void *data, const char *modifier,
long unsigned int value;
struct t_gui_buffer *buffer;
char *result, *ptr_string, *pos_space, *ptr_end, save_end;
const char *color_normal, *color_error;
char *word_for_suggestions, *old_suggestions, *suggestions;
const char *color_normal, *color_error, *ptr_suggestions;
int buffer_has_changed, utf8_char_int, char_size;
int length, index_result, length_word, word_ok;
int length_color_normal, length_color_error, rc;
int input_pos, current_pos, word_start_pos, word_end_pos;
/* make C compiler happy */
(void) data;
@ -676,7 +745,7 @@ weechat_aspell_modifier_cb (void *data, const char *modifier,
if (!aspell_enabled)
return NULL;
if (!string || !string[0])
if (!string)
return NULL;
rc = sscanf (modifier_data, "%lx", &value);
@ -703,12 +772,14 @@ weechat_aspell_modifier_cb (void *data, const char *modifier,
/*
* for performance: return last string built if input string is the
* same (for example user just change cursor position, or input text is
* refreshed with same content)
* same and cursor position is the same (only if suggestions are enabled)
*/
input_pos = weechat_buffer_get_integer (buffer, "input_pos");
if (!buffer_has_changed
&& aspell_last_modifier_string
&& (strcmp (string, aspell_last_modifier_string) == 0))
&& (strcmp (string, aspell_last_modifier_string) == 0)
&& ((weechat_config_integer (weechat_aspell_config_check_suggestions) < 0)
|| (input_pos == aspell_last_buffer_input_pos)))
{
return (aspell_last_modifier_result) ?
strdup (aspell_last_modifier_result) : NULL;
@ -726,8 +797,11 @@ weechat_aspell_modifier_cb (void *data, const char *modifier,
aspell_last_modifier_result = NULL;
}
word_for_suggestions = NULL;
/* save last modifier string received */
aspell_last_modifier_string = strdup (string);
aspell_last_buffer_input_pos = input_pos;
color_normal = weechat_color ("bar_fg");
length_color_normal = strlen (color_normal);
@ -777,6 +851,7 @@ weechat_aspell_modifier_cb (void *data, const char *modifier,
ptr_string = pos_space;
}
current_pos = 0;
while (ptr_string[0])
{
/* find start of word */
@ -789,6 +864,7 @@ weechat_aspell_modifier_cb (void *data, const char *modifier,
memcpy (result + index_result, ptr_string, char_size);
index_result += char_size;
ptr_string += char_size;
current_pos++;
if (!ptr_string[0])
break;
utf8_char_int = weechat_utf8_char_int (ptr_string);
@ -796,12 +872,17 @@ weechat_aspell_modifier_cb (void *data, const char *modifier,
if (!ptr_string[0])
break;
word_start_pos = current_pos;
word_end_pos = current_pos;
/* find end of word */
ptr_end = weechat_utf8_next_char (ptr_string);
utf8_char_int = weechat_utf8_char_int (ptr_end);
while (iswalnum (utf8_char_int) || (utf8_char_int == '\'')
|| (utf8_char_int == '-'))
{
ptr_end = weechat_utf8_next_char (ptr_end);
word_end_pos++;
if (!ptr_end[0])
break;
utf8_char_int = weechat_utf8_char_int (ptr_end);
@ -834,7 +915,20 @@ weechat_aspell_modifier_cb (void *data, const char *modifier,
{
if ((save_end != '\0')
|| (weechat_config_integer (weechat_aspell_config_check_real_time)))
{
word_ok = weechat_aspell_check_word (buffer, ptr_string);
if (!word_ok && (input_pos >= word_start_pos))
{
/*
* if word is misspelled and that cursor is after
* the beginning of this word, save the word (we will
* look for suggestions after this loop)
*/
if (word_for_suggestions)
free (word_for_suggestions);
word_for_suggestions = strdup (ptr_string);
}
}
else
word_ok = 1;
}
@ -862,15 +956,55 @@ weechat_aspell_modifier_cb (void *data, const char *modifier,
ptr_end[0] = save_end;
ptr_string = ptr_end;
current_pos = word_end_pos + 1;
}
result[index_result] = '\0';
}
/* save old suggestions in buffer */
ptr_suggestions = weechat_buffer_get_string (buffer,
"localvar_aspell_suggest");
old_suggestions = (ptr_suggestions) ? strdup (ptr_suggestions) : NULL;
/* if there is a misspelled word, get suggestions and set them in buffer */
if (word_for_suggestions)
{
suggestions = weechat_aspell_get_suggestions (word_for_suggestions);
if (suggestions)
{
weechat_buffer_set (buffer, "localvar_set_aspell_suggest",
suggestions);
free (suggestions);
}
else
{
weechat_buffer_set (buffer, "localvar_del_aspell_suggest", "");
}
free (word_for_suggestions);
}
else
{
weechat_buffer_set (buffer, "localvar_del_aspell_suggest", "");
}
/* if suggestions have changed, update the bar item */
ptr_suggestions = weechat_buffer_get_string (buffer,
"localvar_aspell_suggest");
if ((old_suggestions && !ptr_suggestions)
|| (!old_suggestions && ptr_suggestions)
|| (old_suggestions && ptr_suggestions
&& (strcmp (old_suggestions, ptr_suggestions) != 0)))
{
weechat_bar_item_update ("aspell_suggest");
}
if (old_suggestions)
free (old_suggestions);
if (!result)
return NULL;
aspell_last_modifier_result = strdup (result);
return result;
}
@ -1053,8 +1187,9 @@ weechat_aspell_buffer_switch_cb (void *data, const char *signal,
(void) type_data;
(void) signal_data;
/* refresh bar item "aspell_dict" (for root bars) */
/* refresh bar items (for root bars) */
weechat_bar_item_update ("aspell_dict");
weechat_bar_item_update ("aspell_suggest");
return WEECHAT_RC_OK;
}
@ -1073,8 +1208,9 @@ weechat_aspell_window_switch_cb (void *data, const char *signal,
(void) type_data;
(void) signal_data;
/* refresh bar item "aspell_dict" (for root bars) */
/* refresh bar items (for root bars) */
weechat_bar_item_update ("aspell_dict");
weechat_bar_item_update ("aspell_suggest");
return WEECHAT_RC_OK;
}