| 3067 | |
| 3068 | |
| 3069 | bool IsHotstringWordChar(TCHAR aChar) |
| 3070 | // Returns true if aChar would be part of a word if followed by a word char. |
| 3071 | // aChar itself may be a word char or a nonspacing mark which combines with |
| 3072 | // the next character (the first character of a potential hotstring match). |
| 3073 | { |
| 3074 | // IsCharAlphaNumeric is used for simplicity and to preserve old behaviour |
| 3075 | // (with the only exception being the one added below), in case it's what |
| 3076 | // users have come to expect. Note that checking for C1_ALPHA or C3_ALPHA |
| 3077 | // and C1_DIGIT is not equivalent: Michael S. Kaplan wrote that the real |
| 3078 | // conditions are "(C1_ALPHA && ! (C3_HIRAGANA | C3_KATAKANA) || C1_DIGIT)" -- https://web.archive.org/web/20130627015450/http://blogs.msdn.com/b/michkap/archive/2007/06/19/3396819.aspx |
| 3079 | if (IsCharAlphaNumeric(aChar)) |
| 3080 | return true; |
| 3081 | WORD char_type; |
| 3082 | if (GetStringTypeEx(LOCALE_USER_DEFAULT, CT_CTYPE3, &aChar, 1, &char_type)) |
| 3083 | { |
| 3084 | // Nonspacing marks combine with the following character, so would visually |
| 3085 | // appear to be part of the word. This should fix detection of words beginning |
| 3086 | // with or containing Arabic nonspacing diacritics, for example. |
| 3087 | if (char_type & C3_NONSPACING) |
| 3088 | return true; |
| 3089 | } |
| 3090 | return false; |
| 3091 | } |
| 3092 | |
| 3093 | |
| 3094 | |