r23101 by jghali - #15752: Spell checker recognises comma symbol as an error
scribus-commit
scribus-commit at lists.scribus.net
Sun Aug 4 07:02:45 UTC 2019
Author: jghali
Date: Sun Aug 4 07:02:44 2019
New Revision: 23101
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23101
Log:
#15752: Spell checker recognises comma symbol as an error
Modified:
trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspellpluginimpl.cpp
trunk/Scribus/scribus/text/storytext.cpp
Modified: trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspellpluginimpl.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23101&path=/trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspellpluginimpl.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspellpluginimpl.cpp (original)
+++ trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspellpluginimpl.cpp Sun Aug 4 07:02:44 2019
@@ -121,18 +121,18 @@
{
wordStart = currPos;
int wordEnd = iText->endOfWord(wordStart);
- QString word = iText->text(wordStart,wordEnd - wordStart);
+ QString word = iText->text(wordStart, wordEnd - wordStart);
// remove any Ignorable Code Point
QString tmp = word;
QString tmp2;
- for (int i =0; i < word.size(); ++i)
+ for (int i = 0; i < word.size(); ++i)
{
if (!SpecialChars::isIgnorableCodePoint(tmp.at(i).unicode()))
tmp2 += tmp.at(i);
}
word = tmp2;
+
QString wordLang = iText->charStyle(wordStart).language();
-
if (wordLang.isEmpty())
{
const StyleSet<CharStyle> &tmp(m_doc->charStyles());
@@ -147,9 +147,8 @@
//we now use the abbreviation
//wordLang=LanguageManager::instance()->getAbbrevFromLang(wordLang, true, false);
//A little hack as for some reason our en dictionary from the aspell plugin was not called en_GB or en_US but en, content was en_GB though. Meh.
- if (wordLang=="en")
- wordLang="en_GB";
- // int spellerIndex=0;
+ if (wordLang == "en")
+ wordLang = "en_GB";
//qDebug()<<"Word:"<<word<<wordLang;
if (!dictionaryMap.contains(wordLang))
{
@@ -173,7 +172,6 @@
++i;
++it;
}
- // spellerIndex = i;
}
if (hspellerMap.contains(wordLang) && hspellerMap[wordLang]->spell(word)==0)
@@ -190,7 +188,7 @@
wf.replacements = hspellerMap[wordLang]->suggest(word);
wordsToCorrect.append(wf);
}
- currPos = iText->endOfWord(wordStart);
+ currPos = iText->nextWord(wordStart);
}
return true;
}
Modified: trunk/Scribus/scribus/text/storytext.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23101&path=/trunk/Scribus/scribus/text/storytext.cpp
==============================================================================
--- trunk/Scribus/scribus/text/storytext.cpp (original)
+++ trunk/Scribus/scribus/text/storytext.cpp Sun Aug 4 07:02:44 2019
@@ -1653,7 +1653,10 @@
it->setText((const UChar*) plainText().utf16());
pos = it->following(pos);
- pos = it->next();
+
+ int len = length();
+ while ((pos < len) && (text(pos).isSpace() || text(pos).isPunct()))
+ ++pos;
return pos;
}
More information about the scribus-commit
mailing list