Skip to content

Add display line filter bar for file compare window#3374

Merged
sdottaka merged 31 commits into
masterfrom
feature/line-display-filter
May 24, 2026
Merged

Add display line filter bar for file compare window#3374
sdottaka merged 31 commits into
masterfrom
feature/line-display-filter

Conversation

@sdottaka
Copy link
Copy Markdown
Member

@sdottaka sdottaka commented May 12, 2026

Add Display Line Filter Feature

Adds a display line filter bar to the File Compare window, allowing users to control which lines are visible without affecting the comparison result.

Changes

New Features

  • Display line filter bar (Ctrl+Shift+L) for File Compare window
  • Filter expressions support line attributes: Line, LineLength, LineNumber, LineFlags, EOL, EOLStr, etc.
  • Context-aware functions: matchContext(), matchNumber(), matchBlockNumber(), matchBlockCount(), matchInside(), etc.
  • Right-click "Add to Display Filters" to build filter expressions from selected text
  • Display folder filter for Folder Compare window

Improvements to Filter Expression Engine

  • Renamed EvalContext to FilterEvalContext, adding ILineDataProvider and FilterSharedContext for line-level evaluation
  • Added none literal
  • Added trim(), trimLeft(), trimRight(),strCount(),strFind(),regexCount(),regexFind(),regexExtract() string functions
  • Added EOL/EOLStr attributes for file and line comparison
  • Added ParseDateTime() supporting additional date formats (YYYY-MM-DD etc.)
  • Refactored function documentation into categorized sections

Code Refactoring

  • Extracted CFilterHelperMenuBase as a base class shared by CFileFilterHelperMenu and CLineFilterHelperMenu
  • Extracted common menu utilities into FilterMenuHelpers namespace
  • Extracted LineFilterHelper, LineFilterBar, ReplaceListHelper as separate modules

Notes

  • The display filter is applied after the diff context filter
  • matchInside() evaluation is line-based; multiple /* or */ occurrences within a single line are not distinguished

Examples

Expression Description
ERROR Show only lines containing "ERROR"
le:Different Show only lines with differences
le:Different and LeftMissing Show only lines where right side is added (left side is deleted)
le:Different and Line contains "ERROR" Show only lines with differences containing "ERROR"
le:matchContext(Different and Line contains "ERROR", 3, 3) Same as above, with 3 lines of context above and below
le:matchInside(Line contains "BEGIN", Line contains "END") Show only lines within BEGIN...END log blocks
le:LineLength > 80 Show only lines exceeding 80 characters
le:EOLStr = "CRLF" Show only lines with Windows (CRLF) line endings
le:matchBlockNumber(Different) = 1 Show only lines in the first diff block

Screenshots

image image image

Comment thread Src/MergeDoc.cpp Fixed
Comment thread Src/FilterEngine/FilterExpressionNodes.cpp Fixed
Comment thread Src/FilterEngine/FilterExpressionNodes.cpp Fixed
Comment thread Src/FilterEngine/FilterExpressionNodes.cpp Fixed
Comment thread Src/FilterEngine/FilterExpressionNodes.cpp Fixed
Comment thread Src/MergeDoc.cpp Fixed
Comment thread Src/MergeDoc.h Fixed
@sdottaka sdottaka marked this pull request as ready for review May 17, 2026 21:34
@sdottaka sdottaka requested a review from Copilot May 17, 2026 21:35
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a display line filter bar to the file compare window, extending the existing filter-expression engine with line/column-aware fields and helper UI for composing line filters.

Changes:

  • Adds line filter bar UI, menus, dialog helpers, and file-compare integration.
  • Extends filter expressions with line/column providers, none, trim/statistics/match functions, and line-oriented tests.
  • Refactors shared filter menu helpers and updates project/resource wiring.

Reviewed changes

Copilot reviewed 43 out of 45 changed files in this pull request and generated 18 comments.

Show a summary per file
File Description
Testing/GoogleTest/UnitTests/UnitTests.vcxproj.filters Project filter metadata update.
Testing/GoogleTest/UnitTests/UnitTests.vcxproj Project metadata update.
Testing/GoogleTest/FilterEngine/FilterExpression_test.cpp Adds tests for line attributes and new filter functions.
Src/resource.h Adds resource and command IDs for line filter UI.
Src/PropCompareFolder.cpp Updates directive extraction API usage.
Src/MergeEditView.h Adds display-filter commands and column tracking.
Src/MergeEditView.cpp Adds context-menu integration for display filters and column filters.
Src/MergeEditFrm.h Adds line filter bar ownership and handlers.
Src/MergeEditFrm.cpp Implements file-compare filter bar show/hide/menu behavior.
Src/MergeDoc.h Makes merge doc a line data provider and adds display-filter state.
Src/MergeDoc.cpp Applies display filters during line hiding and exposes line data.
Src/Merge.vcxproj.filters Adds new source/header files to VS filters.
Src/Merge.vcxproj Adds new source/header files to the build.
Src/Merge.rc Adds menus/dialog resources for display line filters.
Src/MatchInsideDlg.h Adds match-inside/outside dialog declaration.
Src/MatchInsideDlg.cpp Implements match-inside/outside filter dialog.
Src/LineFilterHelperMenu.h Adds line filter menu helper declaration.
Src/LineFilterHelperMenu.cpp Implements line filter menu expression generation.
Src/LineFilterHelper.h Adds line-filter expression helper API.
Src/LineFilterHelper.cpp Implements line-filter expression parsing/building helpers.
Src/LineFilterBar.h Adds file-compare line filter bar declaration.
Src/LineFilterBar.cpp Implements file-compare line filter bar UI behavior.
Src/FilterMenuHelpers.h Extracts shared recursive menu helper utilities.
Src/FilterEngine/ILineDataProvider.h Defines line/column data provider interface.
Src/FilterEngine/FunctionNodeProperty.cpp Updates property functions for new eval context.
Src/FilterEngine/FilterParser.y Adds none literal grammar support.
Src/FilterEngine/FilterParser.out Regenerated parser output for none.
Src/FilterEngine/FilterParser.h Updates parser token IDs.
Src/FilterEngine/FilterLexer.re Adds none/undefined tokens.
Src/FilterEngine/FilterExpressionNodes.h Updates node eval context and adds none literal/function declarations.
Src/FilterEngine/FilterExpression.h Adds line eval context, shared context, and directive helpers.
Src/FilterEngine/FilterExpression.cpp Implements new eval context and directive helper APIs.
Src/FilterEngine/FilterEngine.vcxitems.filters Adds line provider header to shared filters.
Src/FilterEngine/FilterEngine.vcxitems Adds line provider header to shared project items.
Src/FilterConditionDlg.cpp Extends condition dialog for line/column/date-time filters.
Src/FileFilterHelperMenu.cpp Reuses shared menu helpers and renamed condition IDs.
Src/DirFrame.h Renames display filter bar member/handler for consistency.
Src/DirFrame.cpp Updates directory filter bar member/handler names.
Src/DirFilterBar.h Renames filter bar members/methods for consistency.
Src/DirFilterBar.cpp Updates directory filter bar implementation names.
Src/Common/unicoder.h Adds UTF-8 conversion overload for character ranges.
Src/Common/unicoder.cpp Implements UTF-8 conversion overload.
Src/ClipboardHistory.cpp Silences coroutine deprecation warning before WinRT includes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Src/Merge.rc Outdated
Comment thread Src/Merge.rc Outdated
Comment thread Src/MergeDoc.cpp
Comment thread Src/Common/unicoder.cpp
Comment thread Src/MergeEditFrm.cpp
Comment thread Testing/GoogleTest/FilterEngine/FilterExpression_test.cpp Outdated
Comment thread Src/LineFilterHelperMenu.cpp
Comment thread Src/LineFilterHelperMenu.cpp
Comment thread Src/Merge.rc Outdated
Comment thread Src/Merge.rc Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 62 out of 64 changed files in this pull request and generated 6 comments.

Comment thread Src/resource.h Outdated
Comment thread Src/FilterConditionDlg.cpp
Comment thread Src/FilterConditionDlg.cpp Outdated
Comment thread Src/Common/ValidatingEdit.cpp Outdated
Comment thread Src/MergeEditFrm.cpp
Comment thread Src/DirFrame.cpp Outdated
Comment thread Src/LineFilterHelperMenu.cpp Fixed
Comment thread Src/LineFilterHelperMenu.cpp Fixed
Comment thread Src/LineFilterHelperMenu.cpp Fixed
Comment thread Src/FilterEngine/FilterExpressionNodes.cpp Fixed
Comment thread Src/LineFilterHelperMenu.cpp Fixed
@sdottaka sdottaka force-pushed the feature/line-display-filter branch from a420444 to b7472c1 Compare May 23, 2026 07:27
@sdottaka
Copy link
Copy Markdown
Member Author

@copilot resolve the merge conflicts in this pull request

…y-filter

# Conflicts:
#	Docs/Manual/Spanish/Configuration.xml
#	Docs/Manual/Spanish/Filters.xml
#	Translations/Docs/Manual/Spanish.po
Copy link
Copy Markdown
Contributor

Copilot AI commented May 24, 2026

@copilot resolve the merge conflicts in this pull request

Done. I resolved the merge conflicts and finalized the merge commit in e295d46a0.

@sdottaka sdottaka merged commit bf84405 into master May 24, 2026
@sdottaka sdottaka deleted the feature/line-display-filter branch May 24, 2026 08:41
@sdottaka sdottaka added this to the v2.16.57 milestone May 24, 2026
Marcellomco added a commit to Marcellomco/winmerge that referenced this pull request May 24, 2026
Added translation for "Add display line filter bar for file compare window (WinMerge#3374)"
@Marcellomco Marcellomco mentioned this pull request May 24, 2026
sdottaka pushed a commit that referenced this pull request May 24, 2026
Added translation for "Add display line filter bar for file compare window (#3374)"
@Havoc7891 Havoc7891 mentioned this pull request May 25, 2026
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.

4 participants