@@ -130,7 +130,7 @@ struct TextSegments
130130 return true ;
131131 }
132132 }
133- void Make (const std::wstring& text)
133+ void Make (const std::wstring& text, bool ignoreNumbers )
134134 {
135135 allText = text;
136136 int charTypePrev = -1 ;
@@ -143,6 +143,8 @@ struct TextSegments
143143 charType = 1 ;
144144 else if (isWordBreak (ch))
145145 charType = 2 ;
146+ else if (ignoreNumbers && iswdigit (ch))
147+ charType = 3 ;
146148 if (charType == 2 || charType != charTypePrev)
147149 {
148150 if (i > 0 )
@@ -200,7 +202,7 @@ class DataForDiff
200202 bool equals (const char * scanline1, unsigned size1,
201203 const char * scanline2, unsigned size2) const
202204 {
203- if (!m_diffOptions.ignoreCase && m_diffOptions.ignoreWhitespace == 0 )
205+ if (!m_diffOptions.ignoreCase && m_diffOptions.ignoreWhitespace == 0 && !m_diffOptions. ignoreNumbers )
204206 {
205207 if (size1 != size2)
206208 return false ;
@@ -223,6 +225,13 @@ class DataForDiff
223225 i1++;
224226 while (i2 < s2 && iswspace (l2[i2]))
225227 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+ }
226235 }
227236 }
228237 else if (m_diffOptions.ignoreWhitespace == 1 )
@@ -238,6 +247,15 @@ class DataForDiff
238247 i2++;
239248 continue ;
240249 }
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+ }
241259 if (!match_a_wchar (l1[i1++], l2[i2++]))
242260 return false ;
243261 }
@@ -246,6 +264,15 @@ class DataForDiff
246264 {
247265 while (i1 < s1 && i2 < s2)
248266 {
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+ }
249276 if (!match_a_wchar (l1[i1++], l2[i2++]))
250277 return false ;
251278 }
@@ -265,7 +292,7 @@ class DataForDiff
265292 const wchar_t * begin = reinterpret_cast <const wchar_t *>(scanline);
266293 const wchar_t * end = reinterpret_cast <const wchar_t *>(this ->next (scanline));
267294
268- if (!m_diffOptions.ignoreCase && m_diffOptions.ignoreWhitespace == 0 )
295+ if (!m_diffOptions.ignoreCase && m_diffOptions.ignoreWhitespace == 0 && !m_diffOptions. ignoreNumbers )
269296 {
270297 for (const auto * ptr = begin; ptr < end; ptr++)
271298 {
@@ -289,6 +316,8 @@ class DataForDiff
289316 }
290317 continue ;
291318 }
319+ if (m_diffOptions.ignoreNumbers && iswdigit (*ptr))
320+ continue ;
292321 ha += (ha << 5 );
293322 ha ^= hash_a_wchar (*ptr);
294323 }
@@ -676,9 +705,9 @@ class Highlighter
676705 std::pair<WValue*, WValue*> pair = domutils::findNodeId (m_documents[pane][L" root" ], diffInfo.nodeIds [pane]);
677706 pvalues[pane] = pair.first ;
678707 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 );
680709 else
681- textSegments[pane].Make (L" " );
710+ textSegments[pane].Make (L" " , m_diffOptions. ignoreNumbers );
682711 }
683712 if (m_showWordDifferences)
684713 wordDiffInfoList = Comparer::compare (m_diffOptions, textSegments);
0 commit comments