mmanela / diffplex

DiffPlex is Netstandard 1.0+ C# library to generate textual diffs.
Apache License 2.0
996 stars 183 forks source link

Refactor the feature to collapse unchanged sections #77

Closed kingcean closed 3 years ago

kingcean commented 3 years ago

67 Ignore unchanged lines is a notable feature to enable a way to collapse some of lines unchanged. I appreciate the contributor/author to provide such great idea and cost time to implement it.

In this PR, I have rewritten those codes by a different new way to boost performance and to apply it to all controls.

Performance enhancement

Speed up to 3-6x (test locally) in following scenarios.

Controls

The old implementation was only for DiffViewer control but now (in this PR) this feature also supports SideBySideDiffViewer control and InlineDiffViewer control.

Plus, for context menu of header in DiffViewer control, I have also added the menu items to get and set the count of the context line directly when the unchanged sections are collapsed.

Screenshot_20210312_DiffPlex_FoldLines

Other updates

Fix following bugs brought in by old implementation to ignore unchanged lines. It re-organizes the input data but neglects some corner-cases. These codes have been removed/reverted here during I rewrite all the logic.

And improve following items.

mmanela commented 3 years ago

@kingcean Thanks for the change. I am testing it and I dont see the new context menu. image

kingcean commented 3 years ago

Hi @mmanela, please right click Old or New at the top of the window to popup that context menu and you will see Unified View, Split View and Collapse unchanged sections menu items there. After select Collapse unchanged sections, a new menu item Lines for context appears in that menu context (you need right click again to see).

And you can also left click (or tap) the ellipse (…) button in next to the button Switch mode at bottom to pop-up that context menu.