Mercurial > ~mikael > mcabber > hg
comparison mcabber/mcabber/screen.c @ 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 | bc10fc4eced7 |
comparison
equal
deleted
inserted
replaced
2170:282531385f34 | 2171:46d1182d45be |
---|---|
4555 for (lang_iter = langs; *lang_iter; ++lang_iter) { | 4555 for (lang_iter = langs; *lang_iter; ++lang_iter) { |
4556 if (**lang_iter) { // Skip empty strings | 4556 if (**lang_iter) { // Skip empty strings |
4557 sc = new_spell_checker(*lang_iter); | 4557 sc = new_spell_checker(*lang_iter); |
4558 if (sc) { | 4558 if (sc) { |
4559 spell_checkers = g_slist_append(spell_checkers, sc); | 4559 spell_checkers = g_slist_append(spell_checkers, sc); |
4560 } else { | |
4561 scr_LogPrint(LPRINT_LOGNORM, | |
4562 "Warning: Could not load spell checker language '%s'.", | |
4563 *lang_iter); | |
4560 } | 4564 } |
4561 } | 4565 } |
4562 } | 4566 } |
4563 g_strfreev(langs); | 4567 g_strfreev(langs); |
4564 } | 4568 } |
4599 spell_substring substr; | 4603 spell_substring substr; |
4600 | 4604 |
4601 if (inputLine[0] == 0 || inputLine[0] == COMMAND_CHAR) | 4605 if (inputLine[0] == 0 || inputLine[0] == COMMAND_CHAR) |
4602 return; | 4606 return; |
4603 | 4607 |
4608 // Give up early if not languages are loaded | |
4609 if (!spell_checkers) | |
4610 return; | |
4611 | |
4604 line_start = line; | 4612 line_start = line; |
4605 | 4613 |
4606 while (*line) { | 4614 while (*line) { |
4607 | 4615 |
4608 if (!spell_isalpha(line)) { | 4616 if (!spell_isalpha(line)) { |