changeset 2171:46d1182d45be

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.
author Mikael Berthe <mikael@lilotux.net>
date Sun, 15 Feb 2015 17:07:05 +0100
parents 282531385f34
children 06669fc1810c
files mcabber/mcabber/screen.c
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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) {