@@ -130,7 +130,7 @@ struct TextSegments
130
130
return true ;
131
131
}
132
132
}
133
- void Make (const std::wstring& text)
133
+ void Make (const std::wstring& text, bool ignoreNumbers )
134
134
{
135
135
allText = text;
136
136
int charTypePrev = -1 ;
@@ -143,6 +143,8 @@ struct TextSegments
143
143
charType = 1 ;
144
144
else if (isWordBreak (ch))
145
145
charType = 2 ;
146
+ else if (ignoreNumbers && iswdigit (ch))
147
+ charType = 3 ;
146
148
if (charType == 2 || charType != charTypePrev)
147
149
{
148
150
if (i > 0 )
@@ -200,7 +202,7 @@ class DataForDiff
200
202
bool equals (const char * scanline1, unsigned size1,
201
203
const char * scanline2, unsigned size2) const
202
204
{
203
- if (!m_diffOptions.ignoreCase && m_diffOptions.ignoreWhitespace == 0 )
205
+ if (!m_diffOptions.ignoreCase && m_diffOptions.ignoreWhitespace == 0 && !m_diffOptions. ignoreNumbers )
204
206
{
205
207
if (size1 != size2)
206
208
return false ;
@@ -223,6 +225,13 @@ class DataForDiff
223
225
i1++;
224
226
while (i2 < s2 && iswspace (l2[i2]))
225
227
i2++;
228
+ if (m_diffOptions.ignoreNumbers )
229
+ {
230
+ while (i1 < s1 && iswdigit (l1[i1]))
231
+ i1++;
232
+ while (i2 < s2 && iswdigit (l2[i2]))
233
+ i2++;
234
+ }
226
235
}
227
236
}
228
237
else if (m_diffOptions.ignoreWhitespace == 1 )
@@ -238,6 +247,15 @@ class DataForDiff
238
247
i2++;
239
248
continue ;
240
249
}
250
+ if (m_diffOptions.ignoreNumbers )
251
+ {
252
+ while (i1 < s1 && iswdigit (l1[i1]))
253
+ i1++;
254
+ while (i2 < s2 && iswdigit (l2[i2]))
255
+ i2++;
256
+ if (i1 >= s1 || i2 >= s2)
257
+ continue ;
258
+ }
241
259
if (!match_a_wchar (l1[i1++], l2[i2++]))
242
260
return false ;
243
261
}
@@ -246,6 +264,15 @@ class DataForDiff
246
264
{
247
265
while (i1 < s1 && i2 < s2)
248
266
{
267
+ if (m_diffOptions.ignoreNumbers )
268
+ {
269
+ while (i1 < s1 && iswdigit (l1[i1]))
270
+ i1++;
271
+ while (i2 < s2 && iswdigit (l2[i2]))
272
+ i2++;
273
+ if (i1 >= s1 || i2 >= s2)
274
+ continue ;
275
+ }
249
276
if (!match_a_wchar (l1[i1++], l2[i2++]))
250
277
return false ;
251
278
}
@@ -265,7 +292,7 @@ class DataForDiff
265
292
const wchar_t * begin = reinterpret_cast <const wchar_t *>(scanline);
266
293
const wchar_t * end = reinterpret_cast <const wchar_t *>(this ->next (scanline));
267
294
268
- if (!m_diffOptions.ignoreCase && m_diffOptions.ignoreWhitespace == 0 )
295
+ if (!m_diffOptions.ignoreCase && m_diffOptions.ignoreWhitespace == 0 && !m_diffOptions. ignoreNumbers )
269
296
{
270
297
for (const auto * ptr = begin; ptr < end; ptr++)
271
298
{
@@ -289,6 +316,8 @@ class DataForDiff
289
316
}
290
317
continue ;
291
318
}
319
+ if (m_diffOptions.ignoreNumbers && iswdigit (*ptr))
320
+ continue ;
292
321
ha += (ha << 5 );
293
322
ha ^= hash_a_wchar (*ptr);
294
323
}
@@ -676,9 +705,9 @@ class Highlighter
676
705
std::pair<WValue*, WValue*> pair = domutils::findNodeId (m_documents[pane][L" root" ], diffInfo.nodeIds [pane]);
677
706
pvalues[pane] = pair.first ;
678
707
if (diffInfo.nodePos [pane] == 0 && pvalues[pane])
679
- textSegments[pane].Make ((*pvalues[pane])[L" nodeValue" ].GetString ());
708
+ textSegments[pane].Make ((*pvalues[pane])[L" nodeValue" ].GetString (), m_diffOptions. ignoreNumbers );
680
709
else
681
- textSegments[pane].Make (L" " );
710
+ textSegments[pane].Make (L" " , m_diffOptions. ignoreNumbers );
682
711
}
683
712
if (m_showWordDifferences)
684
713
wordDiffInfoList = Comparer::compare (m_diffOptions, textSegments);
0 commit comments