Add Unpacker and Prediffer fields to file filter expressions#3295
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds two new global filter-expression fields—Unpacker and Prediffer—to allow filtering files by the plugin pipeline used during comparisons, with corresponding UI and documentation updates.
Changes:
- Extend filter expression evaluation to expose
Unpacker/Predifferas string fields. - Integrate the new fields into the filter helper menu and filter condition dialog operator/UI logic.
- Update manual/documentation strings (including translation template updates) to describe the new fields and usage examples.
Reviewed changes
Copilot reviewed 10 out of 15 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| Src/FilterEngine/FilterExpressionNodes.cpp | Adds Unpacker/Prediffer field evaluators and wires them into field-name parsing. |
| Src/FileFilterHelperMenu.cpp | Adds helper-menu actions to build expressions using Unpacker/Prediffer. |
| Src/FilterConditionDlg.cpp | Updates operator/“Match case” behavior by classifying Unpacker/Prediffer as string fields. |
| Src/FilterConditionDlg.h | Declares the new IsStringField() helper used by the dialog logic. |
| Src/resource.h | Introduces command IDs for the new helper-menu actions and updates menu ID ranges. |
| Translations/Docs/Manual/English.pot | Updates the translation template with new manual entries for Unpacker/Prediffer and reference shifts. |
Comments suppressed due to low confidence (1)
Src/FilterEngine/FilterExpressionNodes.cpp:1134
- Global fields (side == -2) still accept Left/Middle/Right prefixes because the prefix handling happens before the side == -2 check. For example, an expression like
LeftUnpackerwill be parsed and thenside < 0math maps it to a real index (and in 3‑way it even maps to the wrong side). Since the docs say Unpacker/Prediffer are global and must not support side-specific prefixes, reject prefixed variants (e.g., throw invalid field when prefixlen>0 && side==-2) instead of evaluating them.
else if (strcmp(p, "unpacker") == 0)
{
functmp = UnpackerField;
side = -2;
}
else if (strcmp(p, "prediffer") == 0)
{
functmp = PredifferField;
side = -2;
}
else
throw std::runtime_error("Invalid field name: " + std::string(v.begin(), v.end()));
if (prefixlen > 0)
func = [side, functmp](const FilterExpression* ctxt, const DIFFITEM& di)-> ValueType { return functmp(side < 0 ? ctxt->ctxt->GetCompareDirs() + side: side, ctxt, di); };
else
{
if (side == -2)
{
func = [functmp](const FilterExpression* ctxt, const DIFFITEM& di)-> ValueType { return functmp(-2, ctxt, di); };
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds support for two new filter fields:
These fields allow users to filter files based on the plugin used during comparison.
Examples:
Both fields are global attributes and do not support side-specific prefixes.
Changes include:
Notes: