Improve diff op grouping for full matches
This changes the behavior of the diff op grouping function to return an empty result if the diff is a full match. This also adds an example to demonstrate unified diff rendering.
This commit is contained in:
parent
4459c5ee3a
commit
020701c4d5
5 changed files with 62 additions and 3 deletions
|
|
@ -222,8 +222,9 @@ pub fn group_diff_ops(mut ops: Vec<DiffOp>, n: usize) -> Vec<Vec<DiffOp>> {
|
|||
pending_group.push(op);
|
||||
}
|
||||
|
||||
if !pending_group.is_empty() {
|
||||
rv.push(pending_group);
|
||||
match &pending_group[..] {
|
||||
&[] | &[DiffOp::Equal { .. }] => {}
|
||||
_ => rv.push(pending_group),
|
||||
}
|
||||
|
||||
rv
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue