Mercurial > pidgin.yaz
diff src/gtkimhtml.c @ 3208:2215aa4fabdb
[gaim-migrate @ 3225]
Better detection of words in gtkimhtml selection by Ben Miller
committer: Tailor Script <tailor@pidgin.im>
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Sun, 05 May 2002 01:06:15 +0000 |
parents | cbf2c8d259f2 |
children | 0970eabdd8df |
line wrap: on
line diff
--- a/src/gtkimhtml.c Sat May 04 19:06:01 2002 +0000 +++ b/src/gtkimhtml.c Sun May 05 01:06:15 2002 +0000 @@ -1178,14 +1178,32 @@ start = chunk->sel_start; end = chunk->sel_end; - if (start != chunk->text) - while (start > chunk->text && *(start-1) != ' ') - start--; + if (start != chunk->text) { + if (isalnum(*start) || *start == '\'') + while (start > chunk->text && + (isalnum(*(start-1)) || *(start-1) == '\'')) + start--; + else if (isspace(*start)) + while (start > chunk->text && isspace(*(start-1))) + start--; + else if (ispunct(*start)) + while (start > chunk->text && ispunct(*(start-1))) + start--; + } chunk->sel_start = start; - if (end != NULL) - while (*end != '\0' && *end != ' ') - end++; + if (end != NULL) { + if (isalnum(*end) || *end == '\'') + while (*end != '\0' && + (isalnum(*end) || *end == '\'')) + end++; + else if (isspace(*end)) + while (*end != '\0' && isspace(*end)) + end++; + else if (ispunct(*end)) + while (*end != '\0' && ispunct(*end)) + end++; + } chunk->sel_end = end; }