From 2d0f6c26824cbf68eb8c5a7490d0bb74965c41b6 Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Tue, 4 Sep 2012 19:07:18 +1000 Subject: 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. --- src/Document.cxx | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'src/Document.cxx') 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 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) { -- cgit v1.2.3