Branch: refs/heads/master
Author: Skif-off <Skif-off(a)users.noreply.github.com>
Committer: Skif-off <Skif-off(a)users.noreply.github.com>
Date: Sun, 17 Dec 2017 00:34:03 UTC
Commit: 5bb1ca77d8dcd2af1b8cbf0145b5e58f0277495f
https://github.com/geany/geany-plugins/commit/5bb1ca77d8dcd2af1b8cbf0145b5e…
Log Message:
-----------
GeanyLua: geanylua-ref.html: Fix "zebra" (class "odd"/"even")
Modified Paths:
--------------
geanylua/docs/geanylua-ref.html
Modified: geanylua/docs/geanylua-ref.html
10 lines changed, 5 insertions(+), 5 deletions(-)
===================================================================
@@ -181,27 +181,27 @@
<td class="desc">-- Send a GTK signal to a Geany interface widget.</td>
</tr>
-<tr class="odd">
+<tr class="even">
<td> function <a href="#status"><b>status</b></a> ( message )<br></td>
<td class="desc">-- Send a string to display in the status tab of the messages window.</td>
</tr>
-<tr class="even">
+<tr class="odd">
<td> function <a href="#text"><b>text</b></a> ( [content] )<br></td>
<td class="desc">-- Get or set the contents of the entire document.</td>
</tr>
-<tr class="odd">
+<tr class="even">
<td> function <a href="#word"><b>word</b></a> ( [position] )<br></td>
<td class="desc">-- Get the word at the specified location.</td>
</tr>
-<tr class="even">
+<tr class="odd">
<td> function <a href="#xsel"><b>xsel</b></a> ( [text] )<br></td>
<td class="desc">-- Get or set the contents of the primary X selection.</td>
</tr>
-<tr class="odd">
+<tr class="even">
<td> function <a href="#yield"><b>yield</b></a> ()<br></td>
<td class="desc">-- Refreshes the user interface.</td>
</tr>
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
Branch: refs/heads/master
Author: Frank Lanitz <frank(a)frank.uvena.de>
Committer: GitHub <noreply(a)github.com>
Date: Thu, 25 Jan 2018 20:17:56 UTC
Commit: f812c6058a69fe26461a35c8ed16aceff2c60132
https://github.com/geany/geany-plugins/commit/f812c6058a69fe26461a35c8ed16a…
Log Message:
-----------
Merge pull request #652 from Skif-off/geanylua-newfile
GeanyLua: Add filetype to set in geany.newfile()
Modified Paths:
--------------
geanylua/docs/geanylua-ref.html
geanylua/glspi_doc.c
Modified: geanylua/docs/geanylua-ref.html
33 lines changed, 22 insertions(+), 11 deletions(-)
===================================================================
@@ -136,7 +136,7 @@
</tr>
<tr class="odd">
- <td> function <a href="#newfile"><b>newfile</b></a> ( [filename] )<br></td>
+ <td> function <a href="#newfile"><b>newfile</b></a> ( [filename [, filetype] )<br></td>
<td class="desc">-- Create a new document.</td>
</tr>
@@ -181,27 +181,27 @@
<td class="desc">-- Send a GTK signal to a Geany interface widget.</td>
</tr>
-<tr class="odd">
+<tr class="even">
<td> function <a href="#status"><b>status</b></a> ( message )<br></td>
<td class="desc">-- Send a string to display in the status tab of the messages window.</td>
</tr>
-<tr class="even">
+<tr class="odd">
<td> function <a href="#text"><b>text</b></a> ( [content] )<br></td>
<td class="desc">-- Get or set the contents of the entire document.</td>
</tr>
-<tr class="odd">
+<tr class="even">
<td> function <a href="#word"><b>word</b></a> ( [position] )<br></td>
<td class="desc">-- Get the word at the specified location.</td>
</tr>
-<tr class="even">
+<tr class="odd">
<td> function <a href="#xsel"><b>xsel</b></a> ( [text] )<br></td>
<td class="desc">-- Get or set the contents of the primary X selection.</td>
</tr>
-<tr class="odd">
+<tr class="even">
<td> function <a href="#yield"><b>yield</b></a> ()<br></td>
<td class="desc">-- Refreshes the user interface.</td>
</tr>
@@ -756,11 +756,22 @@
<br><br>
-<a name="newfile"></a><hr><h3><tt>geany.newfile ( [filename] )</tt></h3><p>
-When called with one argument, creates a new document with the specified
-<tt>filename</tt>. </p><p>When called with no arguments, creates a new, untitled document.
-</p><br><br>
-
+<a name="newfile"></a><hr><h3><tt>geany.newfile ( [filename [, filetype] )</tt></h3><p>
+<p>When called with no arguments, creates a new, untitled document.</p>
+<p>When called with one argument, creates a new document with the specified <tt>filename</tt>.</p>
+<p>When called with two argument, creates a new document with the specified
+<tt>filename</tt> and <tt>filetype</tt> (a one-word description of the filetype,
+e.g. "C" or "Python".). If you want untitled document then set <tt>filename</tt> as <tt>""</tt>.</p>
+<p>So you can use it like this:</p>
+<pre>local s = geany.selection();
+
+if (s ~= "") and (s ~= nil) then
+ local t = geany.fileinfo();
+ geany.newfile("", t.type);
+ geany.selection(s);
+end</pre>
+<p>(create a new, untitled document, with selected text and auto set filetype).</p>
+<br><br>
<a name="open"></a><hr><h3><tt>geany.open ( [filename]|[index] )</tt></h3><p>
Modified: geanylua/glspi_doc.c
17 lines changed, 14 insertions(+), 3 deletions(-)
===================================================================
@@ -32,12 +32,23 @@ static gint glspi_filename(lua_State* L)
static gint glspi_newfile(lua_State* L)
{
const gchar *fn=NULL;
- if (lua_gettop(L)>0) {
+ GeanyFiletype *ft=NULL;
+ switch (lua_gettop(L)) {
+ case 0: break;
+ case 2:
+ if (!lua_isstring(L, 2)) { return FAIL_STRING_ARG(2); }
+ const gchar *tmp=lua_tostring(L, 2);
+ if ( '\0' == tmp[0] ) {
+ ft=NULL;
+ } else {
+ ft=filetypes_lookup_by_name(tmp);
+ }
+ default:
if (!lua_isstring(L, 1)) { return FAIL_STRING_ARG(1); }
fn=lua_tostring(L, 1);
- if ( '\0' == fn[0] ) { fn = NULL; }
+ if ( '\0' == fn[0] ) { fn=NULL; }
}
- document_new_file(fn, NULL, NULL);
+ document_new_file(fn, ft, NULL);
return 0;
}
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
Branch: refs/heads/master
Author: LarsDW223 <lars_paulsen(a)web.de>
Committer: LarsDW223 <lars_paulsen(a)web.de>
Date: Sun, 21 Jan 2018 15:21:08 UTC
Commit: e4f726569c6ae09a6fce93c978bc235dfa4b81b7
https://github.com/geany/geany-plugins/commit/e4f726569c6ae09a6fce93c978bc2…
Log Message:
-----------
utils lib: added new function 'gp_filelist_scan_directory_full()'
The new function does quite the same like 'gp_filelist_scan_directory()' but also
has an additional parameter 'flags' which allows to control the returned list content
via flags. Only one flag is defined so far:
FILELIST_FLAG_ADD_DIRS: If set, directories will be present as own list entries
If 'flags' is 0 then the result is the same as by calling 'gp_filelist_scan_directory()'.
Modified Paths:
--------------
utils/src/filelist.c
utils/src/filelist.h
Modified: utils/src/filelist.c
83 lines changed, 80 insertions(+), 3 deletions(-)
===================================================================
@@ -88,7 +88,7 @@ static gboolean filelist_patterns_match(GSList *patterns, const gchar *str)
/* Scan directory searchdir. Input and output parameters come from/go to params. */
-static void filelist_scan_directory_int(const gchar *searchdir, ScanDirParams *params)
+static void filelist_scan_directory_int(const gchar *searchdir, ScanDirParams *params, guint flags)
{
GDir *dir;
gchar *locale_path = utils_get_locale_from_utf8(searchdir);
@@ -115,7 +115,9 @@ static void filelist_scan_directory_int(const gchar *searchdir, ScanDirParams *p
locale_name = g_dir_read_name(dir);
if (!locale_name)
+ {
break;
+ }
utf8_name = utils_get_utf8_from_locale(locale_name);
locale_filename = g_build_filename(locale_path, locale_name, NULL);
@@ -125,8 +127,12 @@ static void filelist_scan_directory_int(const gchar *searchdir, ScanDirParams *p
{
if (!filelist_patterns_match(params->ignored_dirs_list, utf8_name))
{
- filelist_scan_directory_int(utf8_filename, params);
+ filelist_scan_directory_int(utf8_filename, params, flags);
params->folder_count++;
+ if (flags & FILELIST_FLAG_ADD_DIRS)
+ {
+ params->filelist = g_slist_prepend(params->filelist, g_strdup(utf8_filename));
+ }
}
}
else if (g_file_test(locale_filename, G_FILE_TEST_IS_REGULAR))
@@ -190,7 +196,78 @@ GSList *gp_filelist_scan_directory(guint *files, guint *folders, const gchar *se
params.ignored_file_list = filelist_get_precompiled_patterns(ignored_file_patterns);
params.visited_paths = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL);
- filelist_scan_directory_int(searchdir, ¶ms);
+ filelist_scan_directory_int(searchdir, ¶ms, 0);
+ g_hash_table_destroy(params.visited_paths);
+
+ g_slist_foreach(params.file_patterns, (GFunc) g_pattern_spec_free, NULL);
+ g_slist_free(params.file_patterns);
+
+ g_slist_foreach(params.ignored_dirs_list, (GFunc) g_pattern_spec_free, NULL);
+ g_slist_free(params.ignored_dirs_list);
+
+ g_slist_foreach(params.ignored_file_list, (GFunc) g_pattern_spec_free, NULL);
+ g_slist_free(params.ignored_file_list);
+
+ if (files != NULL)
+ {
+ *files = params.file_count;
+ }
+ if (folders != NULL)
+ {
+ *folders = params.folder_count;
+ }
+
+ return params.filelist;
+}
+
+
+/** Scan a directory and return a list of files and directories.
+ *
+ * The function scans directory searchdir and returns a list of files.
+ * The list will only include files which match the patterns in file_patterns.
+ * Directories or files matched by ignored_dirs_patterns or ignored_file_patterns
+ * will not be scanned or added to the list.
+ *
+ * If flags is 0 then the result will be the same as for gp_filelist_scan_directory().
+ *
+ * @param files Can be optionally specified to return the number of matched/found
+ * files in *files.
+ * @param folders Can be optionally specified to return the number of matched/found
+ * folders/sub-directories in *folders.
+ * @param searchdir Directory which shall be scanned
+ * @param file_patterns
+ * File patterns for matching files (e.g. "*.c") or NULL
+ * for all files.
+ * @param ignored_dirs_patterns
+ * Patterns for ignored directories
+ * @param ignored_file_patterns
+ * Patterns for ignored files
+ * @param flags Flags which influence the returned list:
+ * - FILELIST_FLAG_ADD_DIRS: if set, directories will be added
+ * as own list entries. This also includes empty dirs.
+ * @return GSList of matched files
+ *
+ **/
+GSList *gp_filelist_scan_directory_full(guint *files, guint *folders, const gchar *searchdir, gchar **file_patterns,
+ gchar **ignored_dirs_patterns, gchar **ignored_file_patterns, guint flags)
+{
+ ScanDirParams params = { 0 };
+
+ if (!file_patterns || !file_patterns[0])
+ {
+ const gchar *all_pattern[] = { "*", NULL };
+ params.file_patterns = filelist_get_precompiled_patterns((gchar **)all_pattern);
+ }
+ else
+ {
+ params.file_patterns = filelist_get_precompiled_patterns(file_patterns);
+ }
+
+ params.ignored_dirs_list = filelist_get_precompiled_patterns(ignored_dirs_patterns);
+ params.ignored_file_list = filelist_get_precompiled_patterns(ignored_file_patterns);
+
+ params.visited_paths = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL);
+ filelist_scan_directory_int(searchdir, ¶ms, flags);
g_hash_table_destroy(params.visited_paths);
g_slist_foreach(params.file_patterns, (GFunc) g_pattern_spec_free, NULL);
Modified: utils/src/filelist.h
7 lines changed, 7 insertions(+), 0 deletions(-)
===================================================================
@@ -23,8 +23,15 @@
G_BEGIN_DECLS
+typedef enum
+{
+ FILELIST_FLAG_ADD_DIRS = 1,
+}FILELIST_FLAG;
+
GSList *gp_filelist_scan_directory(guint *files, guint *folders, const gchar *searchdir, gchar **file_patterns,
gchar **ignored_dirs_patterns, gchar **ignored_file_patterns);
+GSList *gp_filelist_scan_directory_full(guint *files, guint *folders, const gchar *searchdir, gchar **file_patterns,
+ gchar **ignored_dirs_patterns, gchar **ignored_file_patterns, guint flags);
G_END_DECLS
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
Branch: refs/heads/master
Author: Frank Lanitz <frank(a)frank.uvena.de>
Committer: GitHub <noreply(a)github.com>
Date: Sat, 20 Jan 2018 17:05:50 UTC
Commit: 1db0c26e5b1786c1d16ce520639dafdddfbbf03a
https://github.com/geany/geany-plugins/commit/1db0c26e5b1786c1d16ce520639da…
Log Message:
-----------
Merge pull request #674 from eht16/spellcheck_support_enchant_2_0
SpellCheck: Support Enchant 2.0 and later
Modified Paths:
--------------
build/spellcheck.m4
spellcheck/README
spellcheck/src/Makefile.am
spellcheck/src/scplugin.c
spellcheck/src/speller.c
Modified: build/spellcheck.m4
9 lines changed, 7 insertions(+), 2 deletions(-)
===================================================================
@@ -3,14 +3,19 @@ AC_DEFUN([GP_CHECK_SPELLCHECK],
GP_ARG_DISABLE([spellcheck], [auto])
ENCHANT_VERSION=1.3
- OPT_ENCHANT_VERSION=1.5
- PKG_CHECK_MODULES([ENCHANT], [enchant >= ${OPT_ENCHANT_VERSION}],
+ ENCHANT_VERSION_1_5=1.5
+ ENCHANT_VERSION_2_0=2.0
+ PKG_CHECK_MODULES([ENCHANT_1_5], [enchant >= ${ENCHANT_VERSION_1_5}],
have_enchant_1_5=yes,
have_enchant_1_5=no)
+ PKG_CHECK_MODULES([ENCHANT_2_0], [enchant >= ${ENCHANT_VERSION_2_0}],
+ have_enchant_2_0=yes,
+ have_enchant_2_0=no)
GP_CHECK_PLUGIN_DEPS([spellcheck], [ENCHANT],
[enchant >= ${ENCHANT_VERSION}])
AM_CONDITIONAL([HAVE_ENCHANT_1_5], [test "$have_enchant_1_5" = yes])
+ AM_CONDITIONAL([HAVE_ENCHANT_2_0], [test "$have_enchant_2_0" = yes])
GP_COMMIT_PLUGIN_STATUS([Spellcheck])
AC_CONFIG_FILES([
Modified: spellcheck/README
20 lines changed, 13 insertions(+), 7 deletions(-)
===================================================================
@@ -34,27 +34,33 @@ assign a keyboard shortcut in Geany's preferences dialog to perform a
spell check.
-Configuring dictionaries on Windows
------------------------------------
-On Windows, you might need to install the dictionaries (the files
+Configuring custom dictionaries
+-------------------------------
+Especially Windows, you might need to install the dictionaries (the files
containing the information for spell checking) manually.
First, you need to download the dictionary files for the
languages you want, e.g. from
-http://extensions.services.openoffice.org/en/dictionaries.
-Be sure to download the "Spelling" archives from this site. The
-downloaded archive should contain one or more .dic and .aff files.
+https://cgit.freedesktop.org/libreoffice/dictionaries/tree/ or
+https://addons.mozilla.org/en-US/firefox/language-tools/.
+The downloaded archives should contain one or more .dic and .aff files.
Instructions:
1. Download the archive you want to use
-2. The downloaded archive with the extension .oxt is actually a ZIP
+2. The downloaded archive with extensions like .xpi or .oxt is actually a ZIP
archive, so extract it as usual (e.g. with 7-Zip or another ZIP
unpacker). Extract the contents into a folder of your choice,
e.g. C:\dictionaries
3. Then open to the Spell Check plugin preferences dialog in Geany and
choose the folder you just created. You may need to restart Geany
and then the installed dictionaries should be available
+Note: if you are using Enchant 2.0 or later (the library used by the SpellCheck
+plugin), you need to move the dictionaries into a subfolder called "hunspell"
+in the directory you created above.
+To check which Enchant version you are using, check "Help->Debug Messages" in
+Geany and find the appropriate log message telling about the Enchant version.
+
Known issues
------------
Modified: spellcheck/src/Makefile.am
4 lines changed, 4 insertions(+), 0 deletions(-)
===================================================================
@@ -22,6 +22,10 @@ if HAVE_ENCHANT_1_5
spellcheck_la_CFLAGS += -DHAVE_ENCHANT_1_5
endif
+if HAVE_ENCHANT_2_0
+spellcheck_la_CFLAGS += -DHAVE_ENCHANT_2_0
+endif
+
spellcheck_la_LIBADD = \
$(COMMONLIBS) \
$(ENCHANT_LIBS)
Modified: spellcheck/src/scplugin.c
8 lines changed, 5 insertions(+), 3 deletions(-)
===================================================================
@@ -268,14 +268,14 @@ static void configure_frame_editor_menu_toggled_cb(GtkToggleButton *togglebutton
GtkWidget *plugin_configure(GtkDialog *dialog)
{
- GtkWidget *label_language, *label_dir, *vbox;
+ GtkWidget *label_language, *vbox;
GtkWidget *combo, *check_type, *check_on_open, *check_msgwin, *check_toolbar;
GtkWidget *frame_editor_menu, *check_editor_menu;
GtkWidget *check_editor_menu_sub_menu, *align_editor_menu_sub_menu;
GtkWidget *vbox_interface, *frame_interface, *label_interface;
GtkWidget *vbox_behavior, *frame_behavior, *label_behavior;
#ifdef HAVE_ENCHANT_1_5
- GtkWidget *entry_dir, *hbox, *button, *image;
+ GtkWidget *entry_dir, *label_dir, *hbox, *button, *image;
#endif
vbox = gtk_vbox_new(FALSE, 6);
@@ -352,7 +352,9 @@ GtkWidget *plugin_configure(GtkDialog *dialog)
gtk_label_set_mnemonic_widget(GTK_LABEL(label_dir), entry_dir);
gtk_widget_set_tooltip_text(entry_dir,
_("Read additional dictionary files from this directory. "
- "For now, this only works with myspell dictionaries."));
+ "For now, this only works with hunspell dictionaries. "
+ "With Enchant 2.0 or later, the dictionaries are searched "
+ "in a subfolder called \"hunspell\". See the plugin's Help for details."));
if (! EMPTY(sc_info->dictionary_dir))
gtk_entry_set_text(GTK_ENTRY(entry_dir), sc_info->dictionary_dir);
Modified: spellcheck/src/speller.c
31 lines changed, 30 insertions(+), 1 deletions(-)
===================================================================
@@ -470,7 +470,12 @@ void sc_speller_add_word(const gchar *word)
g_return_if_fail(sc_speller_dict != NULL);
g_return_if_fail(word != NULL);
+#ifdef HAVE_ENCHANT_1_5
+ /* enchant_dict_add() is available since Enchant 1.4 */
+ enchant_dict_add(sc_speller_dict, word, -1);
+#else
enchant_dict_add_to_pwl(sc_speller_dict, word, -1);
+#endif
}
gboolean sc_speller_dict_check(const gchar *word)
@@ -518,7 +523,18 @@ void sc_speller_reinit_enchant_dict(void)
if (sc_speller_dict != NULL)
enchant_broker_free_dict(sc_speller_broker, sc_speller_dict);
-#if HAVE_ENCHANT_1_5
+#ifdef HAVE_ENCHANT_2_0
+ #define ENCHANT_CONFIG_ENV_NAME "ENCHANT_CONFIG_DIR"
+ /* set custom configuration path for enchant (Enchant will look for dictionaries there) */
+ if (! EMPTY(sc_info->dictionary_dir))
+ {
+ g_setenv(ENCHANT_CONFIG_ENV_NAME, sc_info->dictionary_dir, TRUE);
+ }
+ else
+ {
+ g_unsetenv(ENCHANT_CONFIG_ENV_NAME);
+ }
+#elif HAVE_ENCHANT_1_5
{
const gchar *old_path;
gchar *new_path;
@@ -569,8 +585,21 @@ void sc_speller_reinit_enchant_dict(void)
}
+static void log_enchant_version(void)
+{
+#ifdef HAVE_ENCHANT_2_0
+ const gchar *enchant_version = enchant_get_version();
+#else
+ const gchar *enchant_version = "1.6 or older";
+#endif
+
+ g_debug("Initializing Enchant library version %s", enchant_version);
+}
+
+
void sc_speller_init(void)
{
+ log_enchant_version();
sc_speller_broker = enchant_broker_init();
sc_speller_reinit_enchant_dict();
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
Branch: refs/heads/master
Author: Enrico Tröger <enrico.troeger(a)uvena.de>
Committer: Enrico Tröger <enrico.troeger(a)uvena.de>
Date: Sat, 20 Jan 2018 13:32:59 UTC
Commit: 75ac5ab55e029f4da85a6866ce5e0fee66444df2
https://github.com/geany/geany-plugins/commit/75ac5ab55e029f4da85a6866ce5e0…
Log Message:
-----------
SpellCheck: Support Enchant 2.0 and later
Enchant 2.0 dropped some deprecated API and especially introduced
setting custom config/dictionary paths via an environment variable.
So, handle the API differences between Enchant 1.3, 1.5 and 2.0 and
document the changed custom dictionary behavior with 2.0 and later.
Modified Paths:
--------------
build/spellcheck.m4
spellcheck/README
spellcheck/src/Makefile.am
spellcheck/src/scplugin.c
spellcheck/src/speller.c
Modified: build/spellcheck.m4
9 lines changed, 7 insertions(+), 2 deletions(-)
===================================================================
@@ -3,14 +3,19 @@ AC_DEFUN([GP_CHECK_SPELLCHECK],
GP_ARG_DISABLE([spellcheck], [auto])
ENCHANT_VERSION=1.3
- OPT_ENCHANT_VERSION=1.5
- PKG_CHECK_MODULES([ENCHANT], [enchant >= ${OPT_ENCHANT_VERSION}],
+ ENCHANT_VERSION_1_5=1.5
+ ENCHANT_VERSION_2_0=2.0
+ PKG_CHECK_MODULES([ENCHANT_1_5], [enchant >= ${ENCHANT_VERSION_1_5}],
have_enchant_1_5=yes,
have_enchant_1_5=no)
+ PKG_CHECK_MODULES([ENCHANT_2_0], [enchant >= ${ENCHANT_VERSION_2_0}],
+ have_enchant_2_0=yes,
+ have_enchant_2_0=no)
GP_CHECK_PLUGIN_DEPS([spellcheck], [ENCHANT],
[enchant >= ${ENCHANT_VERSION}])
AM_CONDITIONAL([HAVE_ENCHANT_1_5], [test "$have_enchant_1_5" = yes])
+ AM_CONDITIONAL([HAVE_ENCHANT_2_0], [test "$have_enchant_2_0" = yes])
GP_COMMIT_PLUGIN_STATUS([Spellcheck])
AC_CONFIG_FILES([
Modified: spellcheck/README
20 lines changed, 13 insertions(+), 7 deletions(-)
===================================================================
@@ -34,27 +34,33 @@ assign a keyboard shortcut in Geany's preferences dialog to perform a
spell check.
-Configuring dictionaries on Windows
------------------------------------
-On Windows, you might need to install the dictionaries (the files
+Configuring custom dictionaries
+-------------------------------
+Especially Windows, you might need to install the dictionaries (the files
containing the information for spell checking) manually.
First, you need to download the dictionary files for the
languages you want, e.g. from
-http://extensions.services.openoffice.org/en/dictionaries.
-Be sure to download the "Spelling" archives from this site. The
-downloaded archive should contain one or more .dic and .aff files.
+https://cgit.freedesktop.org/libreoffice/dictionaries/tree/ or
+https://addons.mozilla.org/en-US/firefox/language-tools/.
+The downloaded archives should contain one or more .dic and .aff files.
Instructions:
1. Download the archive you want to use
-2. The downloaded archive with the extension .oxt is actually a ZIP
+2. The downloaded archive with extensions like .xpi or .oxt is actually a ZIP
archive, so extract it as usual (e.g. with 7-Zip or another ZIP
unpacker). Extract the contents into a folder of your choice,
e.g. C:\dictionaries
3. Then open to the Spell Check plugin preferences dialog in Geany and
choose the folder you just created. You may need to restart Geany
and then the installed dictionaries should be available
+Note: if you are using Enchant 2.0 or later (the library used by the SpellCheck
+plugin), you need to move the dictionaries into a subfolder called "hunspell"
+in the directory you created above.
+To check which Enchant version you are using, check "Help->Debug Messages" in
+Geany and find the appropriate log message telling about the Enchant version.
+
Known issues
------------
Modified: spellcheck/src/Makefile.am
4 lines changed, 4 insertions(+), 0 deletions(-)
===================================================================
@@ -22,6 +22,10 @@ if HAVE_ENCHANT_1_5
spellcheck_la_CFLAGS += -DHAVE_ENCHANT_1_5
endif
+if HAVE_ENCHANT_2_0
+spellcheck_la_CFLAGS += -DHAVE_ENCHANT_2_0
+endif
+
spellcheck_la_LIBADD = \
$(COMMONLIBS) \
$(ENCHANT_LIBS)
Modified: spellcheck/src/scplugin.c
8 lines changed, 5 insertions(+), 3 deletions(-)
===================================================================
@@ -268,14 +268,14 @@ static void configure_frame_editor_menu_toggled_cb(GtkToggleButton *togglebutton
GtkWidget *plugin_configure(GtkDialog *dialog)
{
- GtkWidget *label_language, *label_dir, *vbox;
+ GtkWidget *label_language, *vbox;
GtkWidget *combo, *check_type, *check_on_open, *check_msgwin, *check_toolbar;
GtkWidget *frame_editor_menu, *check_editor_menu;
GtkWidget *check_editor_menu_sub_menu, *align_editor_menu_sub_menu;
GtkWidget *vbox_interface, *frame_interface, *label_interface;
GtkWidget *vbox_behavior, *frame_behavior, *label_behavior;
#ifdef HAVE_ENCHANT_1_5
- GtkWidget *entry_dir, *hbox, *button, *image;
+ GtkWidget *entry_dir, *label_dir, *hbox, *button, *image;
#endif
vbox = gtk_vbox_new(FALSE, 6);
@@ -352,7 +352,9 @@ GtkWidget *plugin_configure(GtkDialog *dialog)
gtk_label_set_mnemonic_widget(GTK_LABEL(label_dir), entry_dir);
gtk_widget_set_tooltip_text(entry_dir,
_("Read additional dictionary files from this directory. "
- "For now, this only works with myspell dictionaries."));
+ "For now, this only works with hunspell dictionaries. "
+ "With Enchant 2.0 or later, the dictionaries are searched "
+ "in a subfolder called \"hunspell\". See the plugin's Help for details."));
if (! EMPTY(sc_info->dictionary_dir))
gtk_entry_set_text(GTK_ENTRY(entry_dir), sc_info->dictionary_dir);
Modified: spellcheck/src/speller.c
31 lines changed, 30 insertions(+), 1 deletions(-)
===================================================================
@@ -470,7 +470,12 @@ void sc_speller_add_word(const gchar *word)
g_return_if_fail(sc_speller_dict != NULL);
g_return_if_fail(word != NULL);
+#ifdef HAVE_ENCHANT_1_5
+ /* enchant_dict_add() is available since Enchant 1.4 */
+ enchant_dict_add(sc_speller_dict, word, -1);
+#else
enchant_dict_add_to_pwl(sc_speller_dict, word, -1);
+#endif
}
gboolean sc_speller_dict_check(const gchar *word)
@@ -518,7 +523,18 @@ void sc_speller_reinit_enchant_dict(void)
if (sc_speller_dict != NULL)
enchant_broker_free_dict(sc_speller_broker, sc_speller_dict);
-#if HAVE_ENCHANT_1_5
+#ifdef HAVE_ENCHANT_2_0
+ #define ENCHANT_CONFIG_ENV_NAME "ENCHANT_CONFIG_DIR"
+ /* set custom configuration path for enchant (Enchant will look for dictionaries there) */
+ if (! EMPTY(sc_info->dictionary_dir))
+ {
+ g_setenv(ENCHANT_CONFIG_ENV_NAME, sc_info->dictionary_dir, TRUE);
+ }
+ else
+ {
+ g_unsetenv(ENCHANT_CONFIG_ENV_NAME);
+ }
+#elif HAVE_ENCHANT_1_5
{
const gchar *old_path;
gchar *new_path;
@@ -569,8 +585,21 @@ void sc_speller_reinit_enchant_dict(void)
}
+static void log_enchant_version(void)
+{
+#ifdef HAVE_ENCHANT_2_0
+ const gchar *enchant_version = enchant_get_version();
+#else
+ const gchar *enchant_version = "1.6 or older";
+#endif
+
+ g_debug("Initializing Enchant library version %s", enchant_version);
+}
+
+
void sc_speller_init(void)
{
+ log_enchant_version();
sc_speller_broker = enchant_broker_init();
sc_speller_reinit_enchant_dict();
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).