Re: iswalnum() vs iswspace()




Eugene Osintsev <osgene@omskelecom.ru> writes:

> Dear Sirs,
> 
> In functions of GTK+ 1.2.7
> 
>   gtkentry.c: gtk_text_move_backward_word(), gtk_move_forward_word()
>   gtktext.c:  gtk_text_move_backward_word(), gtk_move_forward_word()
> 
> I propose to use    gdk_iswspace() and isspace()
> 
> instead of          gdk_iswalnum() and isalnum()
> 
> The reasons:
> 
> 1. Currently UNICODE locales are supported poorly enough or
>    not supported at all, so using iswspace() is safer than
>    using of iswalpnum() for those whose native language is,
>    for instance, Greek, Russian, etc.
> 
> 2. Even if you use only pure 7-bit ascii, it looks rather clumsy to
>    try double-click selecting of something like "@#$%" in the entry or
>    text widget with the contents "foo foo BigFOO -- !! @#$% Next foo"
>    and finding that it is "BigFOO" that is selected, not "@#$%".
> 
> So I think it would be better to treat words as something with
> space delimiters.

To explain the future direction here:

For GTK+-1.4, we will be using Unicode, and provide our own functions
to get unicode properties, so we can rely on the isspace() isalnum()
equivalents to do something proper.

But actually, word boundaries are determined by the language modules
in Pango: You need this because for some languages, words are
not separated by spaces - e.g:

 In Japanese, the boundary between phonetic and ideographic
 characters is treated as a word boundary for navigation.
 
 In Thai, word boundaries need to be determined by dictionary
 matching.

Regards,
                                        Owen




 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]