зеркало из https://github.com/mozilla/gecko-dev.git
Bug 633210 - Single hyphens are marked as spelling mistakes; r=smaug a=beltzner
--HG-- extra : rebase_source : 76821671b08b0727c6131b10e45c9a24b1984509
This commit is contained in:
Родитель
c6d927a508
Коммит
f32d4cdb18
|
@ -915,9 +915,19 @@ WordSplitState::ClassifyCharacter(PRInt32 aIndex, PRBool aRecurse) const
|
|||
charCategory == nsIUGenCategory::kPunctuation ||
|
||||
charCategory == nsIUGenCategory::kSymbol) {
|
||||
// Don't break on hyphens, as hunspell handles them on its own.
|
||||
if (mDOMWordText[aIndex] != '-') {
|
||||
return CHAR_CLASS_SEPARATOR;
|
||||
if (aIndex > 0 &&
|
||||
mDOMWordText[aIndex] == '-' &&
|
||||
mDOMWordText[aIndex - 1] != '-' &&
|
||||
ClassifyCharacter(aIndex - 1, false) == CHAR_CLASS_WORD) {
|
||||
// A hyphen is only meaningful as a separator inside a word
|
||||
// if the previous and next characters are a word character.
|
||||
if (aIndex == PRInt32(mDOMWordText.Length()) - 1)
|
||||
return CHAR_CLASS_SEPARATOR;
|
||||
if (mDOMWordText[aIndex + 1] != '.' &&
|
||||
ClassifyCharacter(aIndex + 1, false) == CHAR_CLASS_WORD)
|
||||
return CHAR_CLASS_WORD;
|
||||
}
|
||||
return CHAR_CLASS_SEPARATOR;
|
||||
}
|
||||
|
||||
// any other character counts as a word
|
||||
|
|
|
@ -53,4 +53,6 @@ needs-focus == caret_after_reframe.html caret_after_reframe-ref.html
|
|||
== spellcheck-period-valid.html spellcheck-period-valid-ref.html
|
||||
== spellcheck-space-valid.html spellcheck-space-valid-ref.html
|
||||
== spellcheck-comma-valid.html spellcheck-comma-valid-ref.html
|
||||
== spellcheck-hyphen-multiple-valid.html spellcheck-hyphen-multiple-valid-ref.html
|
||||
!= spellcheck-hyphen-multiple-invalid.html spellcheck-hyphen-multiple-invalid-ref.html
|
||||
== unneeded_scroll.html unneeded_scroll-ref.html
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<textarea style="width: 400px; height: 200px;" autofocus spellcheck="false">-hlloe hlloe- --hlloe --hlloe ---hlloe hlloe--- ---hlloe----</textarea>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,6 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<textarea style="width: 400px; height: 200px;" autofocus>-hlloe hlloe- --hlloe --hlloe ---hlloe hlloe--- ---hlloe----</textarea>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,6 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<textarea style="width: 400px; height: 200px;" autofocus spellcheck="false">- -- --- -hello hello- --hello --hello ---hello hello--- ---hello----</textarea>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,6 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<textarea style="width: 400px; height: 200px;" autofocus>- -- --- -hello hello- --hello --hello ---hello hello--- ---hello----</textarea>
|
||||
</body>
|
||||
</html>
|
Загрузка…
Ссылка в новой задаче