diff options
| author | mitchell <unknown> | 2019-04-16 22:50:17 -0400 |
|---|---|---|
| committer | mitchell <unknown> | 2019-04-16 22:50:17 -0400 |
| commit | 86266d4700632860705fc2d4e88d4be4f5228be1 (patch) | |
| tree | f330e0f843dcef19d0c69506fa1df4637ccd820e /src/Document.cxx | |
| parent | 4c22cdbe64a4024053c202521b69524c655a2c5d (diff) | |
| download | scintilla-mirror-86266d4700632860705fc2d4e88d4be4f5228be1.tar.gz | |
Backport: Feature [feature-requests:#1259]. Add SCI_SETCHARACTERCATEGORYOPTIMIZATION API to optimize speed of character category features.
Backport of changeset 7392:2832adedd0f4, but with added includes for Sci::clamp().
Diffstat (limited to 'src/Document.cxx')
| -rw-r--r-- | src/Document.cxx | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/Document.cxx b/src/Document.cxx index 4aad2e370..dd11ae42d 100644 --- a/src/Document.cxx +++ b/src/Document.cxx @@ -1710,7 +1710,7 @@ CharClassify::cc Document::WordCharacterClass(unsigned int ch) const { if (dbcsCodePage && (!UTF8IsAscii(ch))) { if (SC_CP_UTF8 == dbcsCodePage) { // Use hard coded Unicode class - const CharacterCategory cc = CategoriseCharacter(ch); + const CharacterCategory cc = charMap.CategoryFor(ch); switch (cc) { // Separator, Line/Paragraph @@ -2169,6 +2169,14 @@ int Document::GetCharsOfClass(CharClassify::cc characterClass, unsigned char *bu return charClass.GetCharsOfClass(characterClass, buffer); } +void Document::SetCharacterCategoryOptimization(int countCharacters) { + charMap.Optimize(countCharacters); +} + +int Document::CharacterCategoryOptimization() const noexcept { + return charMap.Size(); +} + void SCI_METHOD Document::StartStyling(Sci_Position position, char) { endStyled = position; } |
