|
|
|
Lines 867-888
WordSplitState::ClassifyCharacter(PRInt3
|
Link Here
|
|---|
|
| 867 |
return CHAR_CLASS_SEPARATOR; |
867 |
return CHAR_CLASS_SEPARATOR; |
| 868 |
if (ClassifyCharacter(aIndex + 1, false) != CHAR_CLASS_WORD) |
868 |
if (ClassifyCharacter(aIndex + 1, false) != CHAR_CLASS_WORD) |
| 869 |
return CHAR_CLASS_SEPARATOR; |
869 |
return CHAR_CLASS_SEPARATOR; |
| 870 |
|
870 |
|
| 871 |
// char on either side is a word, this counts as a word |
871 |
// char on either side is a word, this counts as a word |
| 872 |
return CHAR_CLASS_WORD; |
872 |
return CHAR_CLASS_WORD; |
| 873 |
} |
873 |
} |
| 874 |
|
874 |
|
| 875 |
// all other punctuation |
875 |
// the char dot is evalued by hunspell if is near to a word char |
|
|
876 |
// for example it can be used into abreviations |
| 877 |
if (aIndex > 0 && |
| 878 |
mDOMWordText[aIndex] == '.' && |
| 879 |
ClassifyCharacter(aIndex - 1, false) == CHAR_CLASS_WORD) |
| 880 |
return CHAR_CLASS_WORD; |
| 881 |
|
| 882 |
// all other punctuation (only if it is at start or end of the word) |
| 876 |
if (charCategory == nsIUGenCategory::kSeparator || |
883 |
if (charCategory == nsIUGenCategory::kSeparator || |
| 877 |
charCategory == nsIUGenCategory::kOther || |
884 |
charCategory == nsIUGenCategory::kOther || |
| 878 |
charCategory == nsIUGenCategory::kPunctuation || |
885 |
charCategory == nsIUGenCategory::kPunctuation || |
| 879 |
charCategory == nsIUGenCategory::kSymbol) |
886 |
charCategory == nsIUGenCategory::kSymbol) { |
| 880 |
return CHAR_CLASS_SEPARATOR; |
887 |
PRBool start = true, end = true; |
|
|
888 |
for (PRInt32 aIndexTmp = aIndex; start && aIndexTmp >= 0; aIndexTmp--) { |
| 889 |
// this will classify the current character |
| 890 |
nsIUGenCategory::nsUGenCategory |
| 891 |
charCategoryTmp = mWordUtil->GetCategories()->Get(PRUint32(mDOMWordText[aIndexTmp])); |
| 892 |
if (charCategoryTmp != nsIUGenCategory::kSeparator && |
| 893 |
charCategoryTmp != nsIUGenCategory::kOther && |
| 894 |
charCategoryTmp != nsIUGenCategory::kPunctuation && |
| 895 |
charCategoryTmp != nsIUGenCategory::kSymbol) |
| 896 |
start = false; |
| 897 |
} |
| 898 |
for (PRInt32 aIndexTmp = aIndex; !start && end && aIndexTmp <= PRInt32(mDOMWordText.Length()) - 1; aIndexTmp++) { |
| 899 |
// this will classify the current character |
| 900 |
nsIUGenCategory::nsUGenCategory |
| 901 |
charCategoryTmp = mWordUtil->GetCategories()->Get(PRUint32(mDOMWordText[aIndexTmp])); |
| 902 |
if (charCategoryTmp != nsIUGenCategory::kSeparator && |
| 903 |
charCategoryTmp != nsIUGenCategory::kOther && |
| 904 |
charCategoryTmp != nsIUGenCategory::kPunctuation && |
| 905 |
charCategoryTmp != nsIUGenCategory::kSymbol) |
| 906 |
end = false; |
| 907 |
} |
| 908 |
if (start || end) |
| 909 |
return CHAR_CLASS_SEPARATOR; |
| 910 |
} |
| 881 |
|
911 |
|
| 882 |
// any other character counts as a word |
912 |
// any other character counts as a word |
| 883 |
return CHAR_CLASS_WORD; |
913 |
return CHAR_CLASS_WORD; |
| 884 |
} |
914 |
} |
| 885 |
|
915 |
|
| 886 |
|
916 |
|
| 887 |
// WordSplitState::Advance |
917 |
// WordSplitState::Advance |
| 888 |
|
918 |
|