ftilmann / latexdiff

Compares two latex files and marks up significant differences between them. Releases on www.ctan.org and mirrors
GNU General Public License v3.0
516 stars 73 forks source link

Potentially greedy pattern for listings #119

Closed jprotze closed 6 years ago

jprotze commented 6 years ago

I have an issue with really long runtime (aborted after several minutes) for a long document with multiple listings. I could fix it by the following change:

https://github.com/ftilmann/latexdiff/blob/master/latexdiff#L2994

- ((?:\%\Q$DELCOMMENT$VERBCOMMENT\E.*?\n)*)
+ ((?:\%\Q$DELCOMMENT$VERBCOMMENT\E[^\n]*?\n)*)

I think the intention is, that the pattern should not match across multiple lines? The alternative would be using a negative look-ahead (instead of the .), to avoid running out of the environment.

ftilmann commented 6 years ago

Wow, how did you track that one down? I would have thought that the minimal matching operator would have implied the non-newline interpretation of "." but apparently not. On my test files, there was no noticeable effect on either output or runtime, but as it seems to help in your case and no adverse effect are known I implemented that exactly as suggested in commit
32decf1