@@ -66,12 +66,12 @@ bool FindRoutine (const CObject * pObject, // passed back to callback rout
66
66
{
67
67
CFindDlg dlg (FindInfo.m_strFindStringList );
68
68
69
- FindInfo.m_iStartColumn = -1 ; // return consistent column number
70
69
71
70
// find what the heck the user wants to do
72
71
73
72
if (!FindInfo.m_bAgain || FindInfo.m_strFindStringList .IsEmpty ())
74
73
{
74
+ FindInfo.m_iStartColumn = -1 ; // return consistent column number
75
75
76
76
if (!FindInfo.m_strFindStringList .IsEmpty ())
77
77
dlg.m_strFindText = FindInfo.m_strFindStringList .GetHead ();
@@ -117,12 +117,20 @@ CFindDlg dlg (FindInfo.m_strFindStringList);
117
117
} // end of not repeating the last find
118
118
else
119
119
{
120
+ if (FindInfo.m_bRepeatOnSameLine )
121
+ FindInfo.m_iStartColumn ++; // skip previous match
122
+ else
123
+ FindInfo.m_iStartColumn = -1 ; // return consistent column number
124
+
120
125
// doing a "find again" - step past the line we were on
121
126
122
- if (FindInfo.m_bForwards )
123
- FindInfo.m_nCurrentLine ++;
124
- else
125
- FindInfo.m_nCurrentLine --;
127
+ if (!FindInfo.m_bRepeatOnSameLine )
128
+ {
129
+ if (FindInfo.m_bForwards )
130
+ FindInfo.m_nCurrentLine ++;
131
+ else
132
+ FindInfo.m_nCurrentLine --;
133
+ } // end of not repeating on same line
126
134
127
135
// re-initiate the search - this will set up the POSITION parameter, if it wants to
128
136
@@ -214,7 +222,7 @@ CString strStatus = TFormat ("Finding: %s", (LPCTSTR) FindInfo.m_strFindStringLi
214
222
if (FindInfo.m_bRegexp )
215
223
{
216
224
217
- if (regexec (FindInfo.m_regexp , strLine))
225
+ if (regexec (FindInfo.m_regexp , strLine, maximum (FindInfo. m_iStartColumn , 0 ) ))
218
226
{
219
227
// work out what column it must have been at
220
228
FindInfo.m_iStartColumn = FindInfo.m_regexp ->m_vOffsets [0 ];
@@ -228,7 +236,7 @@ CString strStatus = TFormat ("Finding: %s", (LPCTSTR) FindInfo.m_strFindStringLi
228
236
// if case-insensitive search wanted, force this line to lower case
229
237
if (!FindInfo.m_bMatchCase )
230
238
strLine.MakeLower ();
231
- if ((FindInfo.m_iStartColumn = strLine.Find (strFindString)) != -1 )
239
+ if ((FindInfo.m_iStartColumn = strLine.Find (strFindString, maximum (FindInfo. m_iStartColumn , 0 ) )) != -1 )
232
240
{
233
241
// work out ending column
234
242
FindInfo.m_iEndColumn = FindInfo.m_iStartColumn +
@@ -240,6 +248,8 @@ CString strStatus = TFormat ("Finding: %s", (LPCTSTR) FindInfo.m_strFindStringLi
240
248
241
249
// keep track of line count
242
250
251
+ FindInfo.m_iStartColumn = -1 ; // back to start for next line
252
+
243
253
if (FindInfo.m_bForwards )
244
254
FindInfo.m_nCurrentLine ++;
245
255
else
0 commit comments