Conversation
Add Color enum type and Style dataclass Move colorize from freestanding function as Style method
…xpansion had been dropped)
The guard checked the reassigned filename and never matched.
Derive match spans from the match object instead of re-scanning each matched line with the regex, tighten the get_line_offsets newline scan, and render colorized lines in a single pass
Search each block with finditer pos/endpos instead of copying the block slice (~9% faster on such files; no change for files that fit in a single block). As a side effect, lookbehind/\A-anchored patterns now also match correctly across block boundaries.
Stop at the first match per file and skip line-offset and context computation entirely (only the presence of a match matters), which is dramatically faster on match-dense files
Extract each matched line directly around the match instead of building the whole block's line-offset table, ~3-6x faster for that output mode
Track the line number with an incrementally advanced newline cursor instead of building the whole block's line-offset table and bisecting it per match (~1.1x typical, up to ~1.8x on match-dense files); the full line-offset path is now used only when context (-A/-B/-C) is requested
Each ignore source is matched as one pathspec spec instead of rule-by-rule (~1.4x faster walking of rule-heavy trees). If the optional `google-re2` package is installed, pathspec uses it automatically for a further speedup; otherwise the pure-Python matcher is used
Installs google-re2, which pathspec then uses automatically to accelerate ignore-file matching further. The default install stays pure-Python (pathspec's built-in matcher is the fallback)
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.
No description provided.