Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Ingramz
Copy link

@Ingramz Ingramz commented May 7, 2019

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:
image

After:
image

Example 2 - previous match context contains the next match.

image

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:
image

After:
image

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.

@Ingramz Ingramz force-pushed the result-stitching branch 4 times, most recently from 1ac7d0b to 44fd95a Compare June 2, 2019 10:20
@Ingramz Ingramz marked this pull request as ready for review June 2, 2019 10:28
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant