diff options
author | 2017-02-12 23:19:49 -0500 | |
---|---|---|
committer | 2017-02-12 23:19:49 -0500 | |
commit | 126bc85d174c7f5ac2bc48674adb6a53327d8e96 (patch) | |
tree | f451136bdeb6b182a3fd801b68bb22654476f7ea | |
parent | a472687ecd4baa1fbbd82e5d6994fa3671387f83 (diff) | |
download | textadept-126bc85d174c7f5ac2bc48674adb6a53327d8e96.tar.gz textadept-126bc85d174c7f5ac2bc48674adb6a53327d8e96.zip |
Fixed "Match Case" toggling during "Regex" searches; src/scintilla.patch
-rw-r--r-- | src/scintilla.patch | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/scintilla.patch b/src/scintilla.patch index 4731fef2..ac950c56 100644 --- a/src/scintilla.patch +++ b/src/scintilla.patch @@ -42,7 +42,7 @@ diff -r bfdfb44eb777 src/Document.cxx + +class TreRegex : public RegexSearchBase { +public: -+ explicit TreRegex() : lastS(NULL), lastSLen(0) {} ++ explicit TreRegex() : lastS(NULL), lastSLen(0), lastSFlags(0) {} + virtual ~TreRegex() { if (lastS) free(lastS), tre_regfree(&preg); } + virtual long FindText(Document *doc, int minPos, int maxPos, const char *s, + bool caseSensitive, bool word, bool wordStart, int flags, @@ -51,7 +51,7 @@ diff -r bfdfb44eb777 src/Document.cxx + int *length); +private: + char *lastS; -+ int lastSLen; ++ int lastSLen, lastSFlags; + regex_t preg; + regmatch_t pmatch[10]; + std::string substituted; @@ -85,14 +85,14 @@ diff -r bfdfb44eb777 src/Document.cxx + } + + // Compile the regex or used the cached one. -+ if (!lastS || lastSLen != *length || strncmp(lastS, s, *length) != 0) { -+ int cflags = REG_EXTENDED | (!caseSensitive ? REG_ICASE : 0) | REG_NEWLINE; ++ int cflags = REG_EXTENDED | (!caseSensitive ? REG_ICASE : 0) | REG_NEWLINE; ++ if (!lastS || lastSLen != *length || lastSFlags != cflags || strncmp(lastS, s, *length) != 0) { + if (tre_regncomp(&preg, s, *length, cflags) != REG_OK) return -1; + if (lastS) free(lastS); + lastS = static_cast<char *>(malloc(*length + 1)); + strncpy(lastS, s, *length); + lastS[*length] = '\0'; -+ lastSLen = *length; ++ lastSLen = *length, lastSFlags = cflags; + } + + // Perform the matching. |