aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornyamatongwe <devnull@localhost>2012-10-04 15:54:08 +1000
committernyamatongwe <devnull@localhost>2012-10-04 15:54:08 +1000
commit823b818b12f03208e9ea3731c37089274397288c (patch)
treecedb9b65ef8bf69dfa3deb4d30555312415ca8cd
parent797f01e02680c7409ed1068b7b148a5b6d1a14ed (diff)
downloadscintilla-mirror-823b818b12f03208e9ea3731c37089274397288c.tar.gz
Fix bug where non-ASCII hex escape did not match.
-rw-r--r--src/RESearch.cxx2
-rw-r--r--test/simpleTests.py8
2 files changed, 9 insertions, 1 deletions
diff --git a/src/RESearch.cxx b/src/RESearch.cxx
index ffcc58d36..87f2a6985 100644
--- a/src/RESearch.cxx
+++ b/src/RESearch.cxx
@@ -788,7 +788,7 @@ int RESearch::Execute(CharacterIndexer &ci, int lp, int endp) {
}
case CHR: /* ordinary char: locate it fast */
c = *(ap+1);
- while ((lp < endp) && (ci.CharAt(lp) != c))
+ while ((lp < endp) && (static_cast<unsigned char>(ci.CharAt(lp)) != c))
lp++;
if (lp >= endp) /* if EOS, fail, else fall thru. */
return 0;
diff --git a/test/simpleTests.py b/test/simpleTests.py
index 275409a22..9085bcf87 100644
--- a/test/simpleTests.py
+++ b/test/simpleTests.py
@@ -868,6 +868,14 @@ class TestSearch(unittest.TestCase):
self.assertEquals(0, self.ed.FindBytes(0, self.ed.Length, b"\S", flags))
self.assertEquals(2, self.ed.FindBytes(0, self.ed.Length, b"\x62", flags))
+ def testRENonASCII(self):
+ self.ed.InsertText(0, b"\xAD")
+ flags = self.ed.SCFIND_REGEXP
+ self.assertEquals(-1, self.ed.FindBytes(0, self.ed.Length, b"\\x10", flags))
+ self.assertEquals(2, self.ed.FindBytes(0, self.ed.Length, b"\\x09", flags))
+ self.assertEquals(-1, self.ed.FindBytes(0, self.ed.Length, b"\\xAB", flags))
+ self.assertEquals(0, self.ed.FindBytes(0, self.ed.Length, b"\\xAD", flags))
+
class TestProperties(unittest.TestCase):
def setUp(self):