From 4c09f98c7f268fc6bb72a261cb45de24e86fdbca Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Thu, 10 Feb 2011 09:42:29 +1100 Subject: Fix for backwards case-insensitive search in code page 936. Bug #3176271. Was not finding each occurance of a given string due to misaligned character access. --- src/Document.cxx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/Document.cxx b/src/Document.cxx index 91a0dda14..c0290936f 100644 --- a/src/Document.cxx +++ b/src/Document.cxx @@ -1309,7 +1309,11 @@ long Document::FindText(int minPos, int maxPos, const char *search, //Platform::DebugPrintf("Find %d %d %s %d\n", startPos, endPos, ft->lpstrText, lengthFind); const int limitPos = Platform::Maximum(startPos, endPos); - int pos = forward ? startPos : (startPos - 1); + int pos = startPos; + if (!forward) { + // Back all of a character + pos = NextPosition(pos, increment); + } if (caseSensitive) { while (forward ? (pos < endSearch) : (pos >= endSearch)) { bool found = (pos + lengthFind) <= limitPos; -- cgit v1.2.3