Skip to content

Add Unpacker and Prediffer fields to file filter expressions#3295

Merged
sdottaka merged 1 commit into
masterfrom
feature/filter-unpacker-prediffer
Apr 4, 2026
Merged

Add Unpacker and Prediffer fields to file filter expressions#3295
sdottaka merged 1 commit into
masterfrom
feature/filter-unpacker-prediffer

Conversation

@sdottaka

@sdottaka sdottaka commented Apr 3, 2026

Copy link
Copy Markdown
Member

This PR adds support for two new filter fields:

  • Unpacker
  • Prediffer

These fields allow users to filter files based on the plugin used during comparison.

Examples:

  • Unpacker = "CompareMSExcelFiles"
  • Prediffer != ""

Both fields are global attributes and do not support side-specific prefixes.

Changes include:

  • Filter expression evaluation support
  • UI integration in the filter helper menu
  • Updates to the filter condition dialog
  • Documentation updates

Notes:

  • These fields return an empty string when no plugin is used
  • Directories are excluded from evaluation

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/Prediffer as 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 LeftUnpacker will be parsed and then side < 0 math 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.

Comment thread Src/FilterEngine/FilterExpressionNodes.cpp
@sdottaka sdottaka marked this pull request as ready for review April 3, 2026 12:16
@sdottaka sdottaka added this to the v2.16.55 milestone Apr 4, 2026
@sdottaka sdottaka merged commit bf25a31 into master Apr 4, 2026
8 checks passed
@sdottaka sdottaka deleted the feature/filter-unpacker-prediffer branch April 4, 2026 03:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants