OSDN Git Service

Issue2:コメントの差異を無視する機能がただしく動作しない ?にて、タブ記号も無視して比較できるよう修正
authorsaitaman <none@none>
Fri, 25 Jun 2010 09:32:12 +0000 (18:32 +0900)
committersaitaman <none@none>
Fri, 25 Jun 2010 09:32:12 +0000 (18:32 +0900)
Src/DiffWrapper.cpp

index 82cd261..bd024c5 100644 (file)
@@ -585,7 +585,7 @@ void CDiffWrapper::PostFilter(int LineNumberLeft, int QtyLinesLeft, int LineNumb
                                        LineDataRight.erase(CommentStrRight);\r
                        }\r
 \r
-                       if (m_options.m_ignoreWhitespace == WHITESPACE_IGNORE_ALL)\r
+               if (m_options.m_ignoreWhitespace == WHITESPACE_IGNORE_ALL)\r
                        {\r
                                //Ignore character case\r
                                std::string::size_type pos = 0;
@@ -593,23 +593,43 @@ void CDiffWrapper::PostFilter(int LineNumberLeft, int QtyLinesLeft, int LineNumb
                                {
                                        LineDataLeft.replace(pos, 1, "");
                                }
+                               pos = 0;
+                               while ((pos = LineDataLeft.find("\t", pos)) != String::npos)
+                               {
+                                       LineDataLeft.replace(pos, 1, "");
+                               }
 
                                pos = 0;
                                while ((pos = LineDataRight.find(" ", pos)) != String::npos)
                                {
                                        LineDataRight.replace(pos, 1, "");
                                }\r
+                               pos = 0;
+                               while ((pos = LineDataRight.find("\t", pos)) != String::npos)
+                               {
+                                       LineDataRight.replace(pos, 1, "");
+                               }\r
                        }
                        else if (m_options.m_ignoreWhitespace == WHITESPACE_IGNORE_CHANGE)\r
                        {\r
                                //Ignore change in whitespace char count\r
                                std::string::size_type pos = 0;
+                               while ((pos = LineDataLeft.find("\t", pos)) != String::npos)
+                               {
+                                       LineDataLeft.replace(pos, 1, " ");
+                               }
+                               pos = 0;
                                while ((pos = LineDataLeft.find("  ", pos)) != String::npos)
                                {
                                        LineDataLeft.replace(pos, 2, " ");
                                }
 
                                pos = 0;
+                               while ((pos = LineDataRight.find("\t", pos)) != String::npos)
+                               {
+                                       LineDataRight.replace(pos, 1, " ");
+                               }\r
+                               pos = 0;
                                while ((pos = LineDataRight.find("  ", pos)) != String::npos)
                                {
                                        LineDataRight.replace(pos, 2, " ");