Skip to content

feat(text): add Line Filter tool#74

Open
punch-github wants to merge 2 commits into
DevToys-app:mainfrom
punch-github:feature/line-filter
Open

feat(text): add Line Filter tool#74
punch-github wants to merge 2 commits into
DevToys-app:mainfrom
punch-github:feature/line-filter

Conversation

@punch-github
Copy link
Copy Markdown

@punch-github punch-github commented Apr 27, 2026

Summary

Adds a new Line Filter tool to the Text group. Given a block of text, it keeps (or excludes) lines that match a pattern — useful for grep-style filtering of logs, CSVs, configs, etc.

Features

  • Three match modes:
    • Plain text — substring match
    • Keywords (any) — whitespace-separated keywords; a line is kept when it contains any of them
    • Regular expression — full .NET regex with a 2-second timeout
  • Case-sensitive toggle
  • Invert match toggle (keep vs. exclude matching lines)
  • Live preview of filtered output
  • Match summaryMatched X of Y lines
  • Yellow highlights of pattern occurrences in the input pane
  • Pattern row stays pinned at the top while the output pane is extended
  • Friendly error InfoBar for invalid regex
  • Loading from a file is handled by the built-in multi-line-input toolbar (no extra UI needed)

Screenshot

line-filter-keywords

Files added

  • src/DevToys.Tools/Tools/Text/LineFilter/LineFilterGuiTool.cs
  • src/DevToys.Tools/Tools/Text/LineFilter/LineFilter.resx
  • src/DevToys.Tools/Tools/Text/LineFilter/LineFilter.Designer.cs
  • docs/screenshots/line-filter-keywords.png

Notes for reviewers

  • Only the English .resx is included; happy to follow up with the locale resx fan-out (or rely on the existing Crowdin pipeline) — please advise.
  • Icon uses FluentSystemIcons glyph \uF211. Happy to swap for a custom DevToys-Tools-Icons glyph if preferred.
  • Builds cleanly against DevToys.Tools.csproj; only pre-existing warnings remain (none from new files).

Testing

  • Verified end-to-end inside the DevToys host (Windows) using a local plugin build of DevToys.Tools.dll:
    • Plain text, Keywords, and Regex modes — all match, highlight, and summary correctly.
    • Case-sensitive toggle behaves as expected in all three modes.
    • Invert match excludes the right lines (highlights still mark the would-be matches in the input).
    • Invalid regex shows the InfoBar without breaking the UI.

DevToys Contributor and others added 2 commits April 27, 2026 16:49
Adds a new Text tool that filters lines from arbitrary input using one of three modes: plain text, whitespace-separated keywords (any-of match), or .NET regular expressions. Toggles for case sensitivity and inverted match (exclude matching lines). Live preview of filtered output, summary of matched/total line counts, and yellow highlights of matched occurrences within the input pane. Configuration row stays pinned at the top so the pattern remains visible while the output is extended.
@punch-github
Copy link
Copy Markdown
Author

This PR addresses the issue DevToys-app/DevToys#1676

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant