diff options
author | nyamatongwe <unknown> | 2012-09-04 19:07:18 +1000 |
---|---|---|
committer | nyamatongwe <unknown> | 2012-09-04 19:07:18 +1000 |
commit | 4ad8875e7e798bc679a6835e309db717a693941a (patch) | |
tree | 6c8ad0dc96474c2b810d49663b8f2e5bb7c7957c /src/Document.cxx | |
parent | 64e8c5fe5f09220d138539e70291f8dd4cbf1e18 (diff) | |
download | scintilla-mirror-4ad8875e7e798bc679a6835e309db717a693941a.tar.gz |
Cache the CaseFolder object between FindText calls so that finding many instances
of a common string in the document doesn't spend excessive time constructing case
folder objects.
Diffstat (limited to 'src/Document.cxx')
-rw-r--r-- | src/Document.cxx | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/Document.cxx b/src/Document.cxx index 4ce62c45b..1938149e7 100644 --- a/src/Document.cxx +++ b/src/Document.cxx @@ -69,6 +69,7 @@ void LexInterface::Colourise(int start, int end) { Document::Document() { refCount = 0; + pcf = NULL; #ifdef _WIN32 eolMode = SC_EOL_CRLF; #else @@ -123,6 +124,8 @@ Document::~Document() { regex = 0; delete pli; pli = 0; + delete pcf; + pcf = 0; } void Document::Init() { @@ -132,6 +135,16 @@ void Document::Init() { } } +bool Document::SetDBCSCodePage(int dbcsCodePage_) { + if (dbcsCodePage != dbcsCodePage_) { + dbcsCodePage = dbcsCodePage_; + SetCaseFolder(NULL); + return true; + } else { + return false; + } +} + void Document::InsertLine(int line) { for (int j=0; j<ldSize; j++) { if (perLineData[j]) @@ -1419,6 +1432,15 @@ bool Document::MatchesWordOptions(bool word, bool wordStart, int pos, int length (wordStart && IsWordStartAt(pos)); } +bool Document::HasCaseFolder(void) const { + return pcf != 0; +} + +void Document::SetCaseFolder(CaseFolder *pcf_) { + delete pcf; + pcf = pcf_; +} + /** * Find text in document, supporting both forward and backward * searches (just pass minPos > maxPos to do a backward search) @@ -1426,7 +1448,7 @@ bool Document::MatchesWordOptions(bool word, bool wordStart, int pos, int length */ long Document::FindText(int minPos, int maxPos, const char *search, bool caseSensitive, bool word, bool wordStart, bool regExp, int flags, - int *length, CaseFolder *pcf) { + int *length) { if (*length <= 0) return minPos; if (regExp) { |