Re: Bug in directory view



On 02/28/2013 10:08 AM, Jeff Webb wrote:
There seems to be a "bug" in meld's directory view.  If the Preferences->Text Filters->"Ignore changes which insert or 
delete blank lines" checkbox is enabled, files which differ only by blank lines show up as being different in the directory view.  If you 
click on one of these files in the directory view, the file diff shows no differences, as expected.  It seems like the fix could be as simple as 
something like what is shown in the patch below.  You may want to do something more efficient, but it seems that something like this is needed 
here.  This fix is very useful in conjunction with something like the "C++ comment" filter when you are comparing different revisions 
of a project and want to find the files that have non-comment differences.  We were trying to do this in a case where someone changed a revision 
number comment in every file.  This fix seems to work for our test case.

Thanks,

Jeff

diff -r -u meld.orig/meld/dirdiff.py meld/meld/dirdiff.py
--- meld.orig/meld/dirdiff.py   2013-02-28 09:38:04.065534644 -0600
+++ meld/meld/dirdiff.py        2013-02-28 09:47:43.497497083 -0600
@@ -179,9 +179,13 @@
          contents = ["".join(c) for c in contents]
          for r in regexes:
              contents = [re.sub(r, "", c) for c in contents]
+        if prefs.ignore_blank_lines:
+            contents = [re.sub('\n*','\n', c) for c in contents]
+            contents = [re.sub('(\r\n)*','\r\n', c) for c in contents]
          result = SameFiltered if all_same(contents) else Different

      _cache[(files, regexes)] = CacheResult(stats, result)
+
      return result


I just realized that the above fix won't work if you don't have any text filters enabled, so things need to 
be handled a little differently in the final version, but you get the idea.

-Jeff



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]