Path: blob/main/editors/fxite/files/patch-src_scisrch.cpp
16461 views
--- src/scisrch.cpp.orig 2013-10-03 09:22:51 UTC1+++ src/scisrch.cpp2@@ -29,6 +29,12 @@3#define SciMsg(im,wp,lp) sci->sendMessage(im,wp,lp)4#define SciStr(im,wp,lp) sci->sendString(im,wp,lp)56+#ifdef FOX_1_7_50_OR_NEWER7+# define RxMatch(rx, str, len, beg, end, mode, npar, fm, to) ( ((rx)->search((str), (len), (fm), (to), (mode), (beg), (end), (npar))) >=0 )8+#else9+# define RxMatch(rx, str, len, beg, end, mode, npar, fm, to) ( ((rx)->match ((str), (len), (beg), (end), (mode), (npar), (fm), (to))) !=0 )10+#endif11+12#if 11314// The capitalization of text inserted by `&' or `\1', `\2', ... `\9' can be altered by15@@ -222,7 +228,7 @@ int SciSearch::FindTextNoSel(const FXString &what, FXu16if (fm<0) { fm=0; }17if (to>len) { to=len; }18FXuint dirn=isfwd?REX_FORWARD:REX_BACKWARD;19- if (rx.match(content,len,begs,ends,dirn,MAX_CAPTURES,fm,to)) {20+ if (RxMatch(&rx,content,len,begs,ends,dirn,MAX_CAPTURES,fm,to)) {21beg=isfwd?begs[0]:ends[0];22end=isfwd?ends[0]:begs[0];23return 1;24@@ -256,8 +262,8 @@ bool SciSearch::FindText(const FXString &what, FXuint25long fm = isfwd? pos : 0;26long to = isfwd? len : (pos-1);27if (28- rx.match(content,len,begs,ends,dirn,MAX_CAPTURES,fm,to) ||29- (wrap && rx.match(content,len,begs,ends,dirn,MAX_CAPTURES,0,len))30+ RxMatch(&rx,content,len,begs,ends,dirn,MAX_CAPTURES,fm,to) ||31+ (wrap && RxMatch(&rx,content,len,begs,ends,dirn,MAX_CAPTURES,0,len))32) {33SciMsg(SCI_SETTARGETSTART,begs[0],0);34SciMsg(SCI_SETTARGETEND,ends[0],0);35@@ -383,8 +389,8 @@ long SciSearch::ReplaceAllInDoc(const FXString &search36SciMsg(SCI_SETSEARCHFLAGS,0,0);37SciMsg(SCI_BEGINUNDOACTION,0,0);38while (1) {39- if (end==start) { break; }40- if (rx.match(content,end,begs,ends,srchflags,MAX_CAPTURES,start,end)) {41+ if (end<=start) { break; }42+ if (RxMatch(&rx,content,end,begs,ends,REX_FORWARD|REX_NOT_EMPTY,MAX_CAPTURES,start,end)) {43SciMsg(SCI_SETTARGETSTART,begs[0],0);44SciMsg(SCI_SETTARGETEND,ends[0],0);45FXString newstr=DoSubstitute(content,begs,ends,repl_template,MAX_CAPTURES);46@@ -438,7 +444,7 @@ long SciSearch::ReplaceAllInSel(const FXString &search4748SciMsg(SCI_SETSEARCHFLAGS,0,0);49if (bol_only) { // Special case, start of first line50- if (rx.match(content,end,begs,ends,REX_FORWARD|REX_NOT_EMPTY,MAX_CAPTURES,start,end)) {51+ if (RxMatch(&rx,content,end,begs,ends,REX_FORWARD|REX_NOT_EMPTY,MAX_CAPTURES,start,end)) {52SciMsg(SCI_SETTARGETSTART,begs[0],0);53SciMsg(SCI_SETTARGETEND,ends[0],0);54FXString newstr=DoSubstitute(content,begs,ends,repl_template,MAX_CAPTURES);55@@ -452,7 +458,7 @@ long SciSearch::ReplaceAllInSel(const FXString &search56long substart=start;57while (1) {58if (end<=substart) { break; }59- if (rx.match(content,end,begs,ends,srchflags,MAX_CAPTURES,substart,end)) {60+ if (RxMatch(&rx,content,end,begs,ends,srchflags,MAX_CAPTURES,substart,end)) {61SciMsg(SCI_SETTARGETSTART,begs[0],0);62SciMsg(SCI_SETTARGETEND,ends[0],0);63FXString newstr=DoSubstitute(content,begs,ends,repl_template,MAX_CAPTURES);646566