As a frequent user of the difference engine, I understand and also request the
pinning feature James mentions. But I will follow-up and make a formal feature
request via the appropriate channel, and James I suggest you do likewise.
Greg, to explain: Pinning is a UI feature where you can explicitly tell BBEdit
that Line N on one side corresponds directly to line M on the other side, thus
overriding what BBEdit's algorithm determines what corresponds. Effectively the
user is partitioning the compared documents and explicitly saying, I want you to
treat what is above this line on each side as if it was the whole document, and
separately what is below this line.
James, lacking the explicit pinning feature, there are a number of tricks I have
employed over time to work around the lack of a formal pinning feature.
Low hanging fruit for your specific scenario that's good anyway is to use block
comments rather than line comments. If Lua supports block comments then use
them, as then the actual number of changed lines would be very minimized, just
an insertion at the top and bottom of the large commented blocks. If Lua
doesn't support block comments I would consider that a language design flaw.
Something I've done repeatedly is temporarily insert large enough blocks of
identical dummy text on both sides so that BBEdit's natural algorithm will treat
them as the same and thus partition the comparison at that point. This can be
done in as many places as needed. The dummy text would have to look very
different from the normal file contents.
Another thing that can help work around the problem is to do updates in stages
and do relatively few changes per stage. If one is using version control there
can be a commit between each stage.
A key thing I do is have separate stages for reordering blocks and doing other
kinds of edits. Or if I change the indenting that's a separate stage. This has
a key benefit also in that in the project's commit history its much easier to
see what changed, when stuff like reordering is separate commits from other
edits, and so on.
-- Darren Duncan