From: Sean E. <sea...@us...> - 2002-05-05 01:06:19
|
Update of /cvsroot/gaim/gaim/src In directory usw-pr-cvs1:/tmp/cvs-serv25151/src Modified Files: gtkimhtml.c Log Message: Better detection of words in gtkimhtml selection by Ben Miller Index: gtkimhtml.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/gtkimhtml.c,v retrieving revision 1.106 retrieving revision 1.107 diff -u -d -r1.106 -r1.107 --- gtkimhtml.c 26 Apr 2002 01:34:02 -0000 1.106 +++ gtkimhtml.c 5 May 2002 01:06:15 -0000 1.107 @@ -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; } |