Mercurial > ~mikael > mcabber > hg
comparison mcabber/src/screen.c @ 1245:e6ddd19956eb
Fix Aspell support on some systems
iswalpha() doesn't seem to work well on some system. Fall back to isalpha()
if the environment isn't UTF-8.
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Mon, 18 Jun 2007 21:35:30 +0200 |
parents | eb9fc5d6d085 |
children | 9f7e6c22cd14 |
comparison
equal
deleted
inserted
replaced
1244:f7b9a00c512d | 1245:e6ddd19956eb |
---|---|
3355 delete_aspell_config(spell_config); | 3355 delete_aspell_config(spell_config); |
3356 spell_config = NULL; | 3356 spell_config = NULL; |
3357 } | 3357 } |
3358 } | 3358 } |
3359 | 3359 |
3360 #define aspell_isalpha(c) (utf8_mode ? iswalpha(get_char(c)) : isalpha(*c)) | |
3361 | |
3360 // Spell checking function | 3362 // Spell checking function |
3361 static void spellcheck(char *line, char *checked) | 3363 static void spellcheck(char *line, char *checked) |
3362 { | 3364 { |
3363 const char *start, *line_start; | 3365 const char *start, *line_start; |
3364 | 3366 |
3367 | 3369 |
3368 line_start = line; | 3370 line_start = line; |
3369 | 3371 |
3370 while (*line) { | 3372 while (*line) { |
3371 | 3373 |
3372 if (!iswalpha(get_char(line))) { | 3374 if (!aspell_isalpha(line)) { |
3373 line = next_char(line); | 3375 line = next_char(line); |
3374 continue; | 3376 continue; |
3375 } | 3377 } |
3376 | 3378 |
3377 if (!strncmp(line, "http://", 7)) { | 3379 if (!strncmp(line, "http://", 7)) { |
3392 continue; | 3394 continue; |
3393 } | 3395 } |
3394 | 3396 |
3395 start = line; | 3397 start = line; |
3396 | 3398 |
3397 while (iswalpha(get_char(line))) | 3399 while (aspell_isalpha(line)) |
3398 line = next_char(line); | 3400 line = next_char(line); |
3399 | 3401 |
3400 if (spell_checker && | 3402 if (spell_checker && |
3401 aspell_speller_check(spell_checker, start, line - start) == 0) | 3403 aspell_speller_check(spell_checker, start, line - start) == 0) |
3402 memset(&checked[start - line_start], ASPELLBADCHAR, line - start); | 3404 memset(&checked[start - line_start], ASPELLBADCHAR, line - start); |