Repository navigation
Match a whole-string glob containing a space against the whole text [patch] - #169
Open
matt-edmondson wants to merge 3 commits into
Open
matt-edmondson wants to merge 3 commits into
matt-edmondson wants to merge 3 commits into
Conversation
…patch] Under ByWholeString, a filter with only plain tokens and inner whitespace is first tried as one glob against the whole text, so "my file.txt" matches "my file.txt". The per-token pass still runs afterwards, so "*.jpg *.png" keeps matching "a.png", and filters with excluded or required tokens are unchanged. Fixes #137 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017vfJW5pNp5mLi7vkHCEABR
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017vfJW5pNp5mLi7vkHCEABR
|
…ring-space # Conflicts: # TextFilter.Test/TextFilterTests.cs
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.



Fixes #137
What changed
DoesMatchGlobsplits the filter on whitespace, so underByWholeStringno single token could equal a text containing a space. When the filter has only plain tokens (no-,!,^or+prefix) and contains inner whitespace, the trimmed filter is now tried as one glob against the whole text first. This is the glob counterpart of the regex fix in Regex filters containing a space or \s never match under the default ByWordAny option ("hello world" doesn't match "hello world") #122."*.jpg *.png"keeps matchinga.png(Glob with ByWholeString requires every optional token to match, so "*.jpg *.png" matches nothing #113).Tests
GlobByWholeStringMatchesTextContainingASpace:"foo bar","my file.txt"(also with surrounding spaces), and"my *.txt".GlobByWholeStringWithASpaceStillNeedsTheWholeTextToMatch:"foo bar"does not match"foo bar baz","foo bar"or"Foo bar"under CaseSensitive, and does match"Foo Bar"under CaseInsensitive.GlobByWholeStringKeepsMultiplePatternsAndPrefixedTokens: the Glob with ByWholeString requires every optional token to match, so "*.jpg *.png" matches nothing #113 multi-pattern case, plus excluded and required tokens.Not done: the issue's optional idea of treating a double-quoted span as one token.
Generated by Claude Code