After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 650432 - Text filters don't apply to inline highlighting
Text filters don't apply to inline highlighting
Status: RESOLVED OBSOLETE
Product: meld
Classification: Other
Component: filediff
git master
Other All
: Normal normal
: ---
Assigned To: meld-maint
meld-maint
: 655014 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2011-05-17 20:32 UTC by Davide
Modified: 2017-12-13 18:56 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
screenshot (100.99 KB, image/png)
2011-05-17 20:32 UTC, Davide
  Details
A proposed patch which fixes this bug (4.79 KB, patch)
2011-05-20 22:21 UTC, Davide
none Details | Review

Description Davide 2011-05-17 20:32:32 UTC
Created attachment 187990 [details]
screenshot

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?
Comment 1 Kai Willadsen 2011-05-18 22:08:41 UTC
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.
Comment 2 Davide 2011-05-20 22:21:48 UTC
Created attachment 188255 [details] [review]
A proposed patch which fixes this bug
Comment 3 Davide 2011-05-20 22:22:51 UTC
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
Davide
Comment 4 Davide 2011-06-06 20:29:34 UTC
Just pinging you on this, did anybody look at my patch?
Comment 5 Kai Willadsen 2011-06-06 22:22:30 UTC
Sorry, I haven't had time to look at this properly yet. Don't worry though; your patch is still on my radar.
Comment 6 Kai Willadsen 2011-06-10 21:37:12 UTC
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):
  • File "/home/foo/meld/meld/task.py", line 130 in iteration
    ret = task()
  • File "/home/foo/meld/meld/filediff.py", line 1235 in _update_highlighting
    s.forward_chars( indexes[0] )
IndexError: list index out of range

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.
Comment 7 Kai Willadsen 2011-07-22 22:04:27 UTC
*** Bug 655014 has been marked as a duplicate of this bug. ***
Comment 8 GNOME Infrastructure Team 2017-12-13 18:56:47 UTC
-- 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.