Mercurial > pidgin
changeset 112:a57fd3390ee4
[gaim-migrate @ 122]
Fixed the bug where if there is more than one word either being removed or
inserted, remaining checks hold. E.g. if there is a rule that 'm' gets
replaced with 'your roommate' (this is actually is one of my rules), and another
rule is 'u' -> 'you', typing "m u" used to be "your roommate u", but is now
"your roommate you" (don't ask, it's a stupid example, but it has implications).
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Fri, 14 Apr 2000 06:02:26 +0000 |
parents | d927bb34e2c6 |
children | 52bfcdc72dcc |
files | plugins/spellchk.c |
diffstat | 1 files changed, 12 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/spellchk.c Thu Apr 13 08:05:57 2000 +0000 +++ b/plugins/spellchk.c Fri Apr 14 06:02:26 2000 +0000 @@ -6,9 +6,7 @@ * ? I think i did everything i want to with it. * * BUGS: - * If you have a numeric replacement, and is preceded by numeric text, - * it doesn't catch it. I don't know why. Probably because it's not - * designed to work with numbers. + * ? I think i fixed them all. */ #define GAIM_PLUGINS #include "gaim.h" @@ -50,9 +48,12 @@ struct replace_words *r; r = (struct replace_words *)(w->data); tmp = have_word(*message, word); - if (!strcmp(have_word(*message, word), r->bad)) + if (!strcmp(have_word(*message, word), r->bad)) { substitute(message, word, strlen(r->bad), r->good); + l += num_words(r->good) - num_words(r->bad); + i += num_words(r->good) - num_words(r->bad); + } free(tmp); w = w->next; } @@ -167,10 +168,10 @@ state = 2; break; case 1: /* inside word */ - if (isspace(m[pos]) || m[pos] == '\'' || m[pos] == '.') + if (m[pos] == '<') + state = 2; + else if (!isalnum(m[pos])) state = 0; - else if (m[pos] == '<') - state = 2; break; case 2: /* inside HTML tag */ if (m[pos] == '>') @@ -196,7 +197,9 @@ state = 2; break; case 1: - if (isspace(m[pos]) || m[pos] == '\'' || m[pos] == '.') + if (m[pos] == '<') + state = 2; + else if (!isalnum(m[pos])) state = 0; break; case 2: @@ -209,7 +212,7 @@ } char *have_word(char *m, int pos) { - char *tmp = strpbrk(&m[pos], "' \t\f\r\n."); + char *tmp = strpbrk(&m[pos], "' \t\f\r\n.?!-,"); int len = (int)(tmp - &m[pos]); if (tmp == NULL) {