Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-ports-kde
Path: blob/main/editors/fxite/files/patch-src_scisrch.cpp
16461 views
1
--- src/scisrch.cpp.orig 2013-10-03 09:22:51 UTC
2
+++ src/scisrch.cpp
3
@@ -29,6 +29,12 @@
4
#define SciMsg(im,wp,lp) sci->sendMessage(im,wp,lp)
5
#define SciStr(im,wp,lp) sci->sendString(im,wp,lp)
6
7
+#ifdef FOX_1_7_50_OR_NEWER
8
+# define RxMatch(rx, str, len, beg, end, mode, npar, fm, to) ( ((rx)->search((str), (len), (fm), (to), (mode), (beg), (end), (npar))) >=0 )
9
+#else
10
+# define RxMatch(rx, str, len, beg, end, mode, npar, fm, to) ( ((rx)->match ((str), (len), (beg), (end), (mode), (npar), (fm), (to))) !=0 )
11
+#endif
12
+
13
#if 1
14
15
// The capitalization of text inserted by `&' or `\1', `\2', ... `\9' can be altered by
16
@@ -222,7 +228,7 @@ int SciSearch::FindTextNoSel(const FXString &what, FXu
17
if (fm<0) { fm=0; }
18
if (to>len) { to=len; }
19
FXuint dirn=isfwd?REX_FORWARD:REX_BACKWARD;
20
- if (rx.match(content,len,begs,ends,dirn,MAX_CAPTURES,fm,to)) {
21
+ if (RxMatch(&rx,content,len,begs,ends,dirn,MAX_CAPTURES,fm,to)) {
22
beg=isfwd?begs[0]:ends[0];
23
end=isfwd?ends[0]:begs[0];
24
return 1;
25
@@ -256,8 +262,8 @@ bool SciSearch::FindText(const FXString &what, FXuint
26
long fm = isfwd? pos : 0;
27
long to = isfwd? len : (pos-1);
28
if (
29
- rx.match(content,len,begs,ends,dirn,MAX_CAPTURES,fm,to) ||
30
- (wrap && rx.match(content,len,begs,ends,dirn,MAX_CAPTURES,0,len))
31
+ RxMatch(&rx,content,len,begs,ends,dirn,MAX_CAPTURES,fm,to) ||
32
+ (wrap && RxMatch(&rx,content,len,begs,ends,dirn,MAX_CAPTURES,0,len))
33
) {
34
SciMsg(SCI_SETTARGETSTART,begs[0],0);
35
SciMsg(SCI_SETTARGETEND,ends[0],0);
36
@@ -383,8 +389,8 @@ long SciSearch::ReplaceAllInDoc(const FXString &search
37
SciMsg(SCI_SETSEARCHFLAGS,0,0);
38
SciMsg(SCI_BEGINUNDOACTION,0,0);
39
while (1) {
40
- if (end==start) { break; }
41
- if (rx.match(content,end,begs,ends,srchflags,MAX_CAPTURES,start,end)) {
42
+ if (end<=start) { break; }
43
+ if (RxMatch(&rx,content,end,begs,ends,REX_FORWARD|REX_NOT_EMPTY,MAX_CAPTURES,start,end)) {
44
SciMsg(SCI_SETTARGETSTART,begs[0],0);
45
SciMsg(SCI_SETTARGETEND,ends[0],0);
46
FXString newstr=DoSubstitute(content,begs,ends,repl_template,MAX_CAPTURES);
47
@@ -438,7 +444,7 @@ long SciSearch::ReplaceAllInSel(const FXString &search
48
49
SciMsg(SCI_SETSEARCHFLAGS,0,0);
50
if (bol_only) { // Special case, start of first line
51
- if (rx.match(content,end,begs,ends,REX_FORWARD|REX_NOT_EMPTY,MAX_CAPTURES,start,end)) {
52
+ if (RxMatch(&rx,content,end,begs,ends,REX_FORWARD|REX_NOT_EMPTY,MAX_CAPTURES,start,end)) {
53
SciMsg(SCI_SETTARGETSTART,begs[0],0);
54
SciMsg(SCI_SETTARGETEND,ends[0],0);
55
FXString newstr=DoSubstitute(content,begs,ends,repl_template,MAX_CAPTURES);
56
@@ -452,7 +458,7 @@ long SciSearch::ReplaceAllInSel(const FXString &search
57
long substart=start;
58
while (1) {
59
if (end<=substart) { break; }
60
- if (rx.match(content,end,begs,ends,srchflags,MAX_CAPTURES,substart,end)) {
61
+ if (RxMatch(&rx,content,end,begs,ends,srchflags,MAX_CAPTURES,substart,end)) {
62
SciMsg(SCI_SETTARGETSTART,begs[0],0);
63
SciMsg(SCI_SETTARGETEND,ends[0],0);
64
FXString newstr=DoSubstitute(content,begs,ends,repl_template,MAX_CAPTURES);
65
66