diff options
author | nyamatongwe <devnull@localhost> | 2012-09-04 19:07:18 +1000 |
---|---|---|
committer | nyamatongwe <devnull@localhost> | 2012-09-04 19:07:18 +1000 |
commit | 2d0f6c26824cbf68eb8c5a7490d0bb74965c41b6 (patch) | |
tree | 5c34dc9de9446a01cd0676dd0451e4e87b3ab91d /src/Document.cxx | |
parent | 9d9e84ef76ded5bc18a4192aa824db5df73f77e8 (diff) | |
download | scintilla-mirror-2d0f6c26824cbf68eb8c5a7490d0bb74965c41b6.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) { |