This repository has been archived by the owner on Dec 15, 2022. It is now read-only.
Stitch together multiple matches from single line #1077
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.
Description of the Change
This pull request intends to fix the representation of multiple matches found on a single line.
To render a line of find results, multiple entries of ~100 characters of context and positional information about the context must be combined into single line, however the current implementation does not do this very well and pieces of text get cut off mid-line. Sometimes these 100 character segments may overlap in various ways, other times they are apart.
Example 1 - search matches are separated by long pieces of text
1000 words of padding with unique number appended to each of them
Before:
After:
Example 2 - previous match context contains the next match.
This was handled well enough by the previous algorithm
Example 3 - search matches between two segments are not contained in eachother, but their surrounding contexts overlap.
Before:
After:
Alternate Designs
The search library, scandal, could be made to return the entire line with ranges containing the matches, then stitching of multiple pieces of text would not be required.
Benefits
Always displays the full context of all matches where overlapping parts are combined.
Possible Drawbacks
None that I can see.
Applicable Issues
Haven't looked, but there could definitely be some.