Spell checking: Fix wrong highlighting when no language can be used
authorMikael Berthe <mikael@lilotux.net>
Sun, 15 Feb 2015 17:07:05 +0100
changeset 2171 46d1182d45be
parent 2170 282531385f34
child 2172 06669fc1810c
Spell checking: Fix wrong highlighting when no language can be used With the previous changeset, mcabber will try to spell check even if no language dictionnary was successfully loaded. This patch also displays a warning when a language cannot be loaded.
mcabber/mcabber/screen.c
--- a/mcabber/mcabber/screen.c	Sun Feb 15 16:23:30 2015 +0100
+++ b/mcabber/mcabber/screen.c	Sun Feb 15 17:07:05 2015 +0100
@@ -4557,6 +4557,10 @@
       sc = new_spell_checker(*lang_iter);
       if (sc) {
         spell_checkers = g_slist_append(spell_checkers, sc);
+      } else {
+        scr_LogPrint(LPRINT_LOGNORM,
+                     "Warning: Could not load spell checker language '%s'.",
+                     *lang_iter);
       }
     }
   }
@@ -4601,6 +4605,10 @@
   if (inputLine[0] == 0 || inputLine[0] == COMMAND_CHAR)
     return;
 
+  // Give up early if not languages are loaded
+  if (!spell_checkers)
+    return;
+
   line_start = line;
 
   while (*line) {