Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve line filters and substitution filters #2032

Merged
merged 14 commits into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 8 additions & 21 deletions Src/CompareEngines/Wrap_DiffUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,32 +144,19 @@ int DiffUtils::CompareFiles(DiffFileData* diffData)
/* Determine range of line numbers involved in each file. */
int first0 = 0, last0 = 0, first1 = 0, last1 = 0, deletes = 0, inserts = 0;
analyze_hunk (thisob, &first0, &last0, &first1, &last1, &deletes, &inserts, diffData->m_inf);

/* Reconnect the script so it will all be freed properly. */
end->link = next;

if (deletes!=0 || inserts!=0 || thisob->trivial!=0)
{
/* Print the lines that the first file has. */
int trans_a0 = 0, trans_b0 = 0, trans_a1 = 0, trans_b1 = 0;
translate_range(&diffData->m_inf[0], first0, last0, &trans_a0, &trans_b0);
translate_range(&diffData->m_inf[1], first1, last1, &trans_a1, &trans_b1);

//Determine quantity of lines in this block for both sides
int QtyLinesLeft = (trans_b0 - trans_a0) + 1;
int QtyLinesRight = (trans_b1 - trans_a1) + 1;
if (usefilters)
OP_TYPE op = (deletes == 0 && inserts == 0) ? OP_TRIVIAL : OP_DIFF;

if (op != OP_TRIVIAL && usefilters)
{
OP_TYPE op = OP_NONE;
if (deletes == 0 && inserts == 0)
op = OP_TRIVIAL;
else
op = OP_DIFF;
m_pDiffWrapper->PostFilter(ctxt, trans_a0 - 1, QtyLinesLeft, trans_a1 - 1, QtyLinesRight, op, diffData->m_inf);
if(op == OP_TRIVIAL)
{
thisob->trivial = 1;
}
m_pDiffWrapper->PostFilter(ctxt, thisob, diffData->m_inf);
}
}
/* Reconnect the script so it will all be freed properly. */
end->link = next;
}
}
}
Expand Down
Loading
Loading