GNOME Bugzilla – Bug 650432
Text filters don't apply to inline highlighting
Last modified: 2017-12-13 18:56:47 UTC
Created attachment 187990 [details]
This is related to bug 650431, which is an example of this bug, but 650431 has a straightforward workaround (i.e. ignoring also whitespace, as described there), which does not exist for this more general case
Consider the following two files, compared with meld using an "ignoreme" text filter:
~/scratch/meld$ cat a.txt; echo; cat b.txt
line 1 ignoreme same stuff here
line 2 ignoreme foo blah blah
line 3 some other stuff ignoreme
line 1 same stuff here
line 2 foo blah blah blah
line 3 ignoreme some other stuff
Difference in line 2 should show only one of the "blah", since "ignoreme" should be ignored. However, that pattern is not ignored.
I understand the (software engineering) reasons why it isn't, and I also assume that in general it's not a big deal for users.
However, in same cases (e.g. when the pattern is complex and there are several matches per line).
I would be eager to completely rewrite the single-line-diff, taking into account filters, but would the patch be accepted?
I'd certainly consider such a patch, and I imagine it would be accepted if its behaviour felt correct. It shouldn't be that difficult to do really... I think.
Created attachment 188255 [details] [review]
A proposed patch which fixes this bug
Ok, please find attached my patch for this (sorry this comment should have been attached to the patch itself)
It works on all the use cases I have tested, but I might have missed some, so please test it with yours (and see bug 650410 - maybe just a few diff files and screenshot could be a ugly but effective end-to-end tests to begin)
Feel free to ask if you have any questions.
Thanks for considering my contribution
Just pinging you on this, did anybody look at my patch?
Sorry, I haven't had time to look at this properly yet. Don't worry though; your patch is still on my radar.
I've just had a quick play with the patch. Unfortunately, the first thing I see is many lines of "this should not happen" debug, plus a traceback that may or may not be useful:
Traceback (most recent call last):
ret = task()
s.forward_chars( indexes )
On an architectural note, it's not clear to me that putting remapping into the CachedSequenceMatcher is a good idea. It's possible that this might fit better into diffutil.py or somewhere; if I understand correctly, it's really a general purpose action on a diff chunk.
Finally, the "\n" joining in update_highlighting is a problem. If we get non-"\n" line terminators in the chunk, I'd expect this to cause offset errors whenever a highlight extends over a line break.
*** Bug 655014 has been marked as a duplicate of this bug. ***
-- GitLab Migration Automatic Message --
This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.
You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/meld/issues/32.