Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Q: Show context #127

Open
tlamr opened this issue Feb 20, 2021 · 6 comments
Open

Q: Show context #127

tlamr opened this issue Feb 20, 2021 · 6 comments

Comments

@tlamr
Copy link

tlamr commented Feb 20, 2021

Hi guys,

is it possible to show search term context in browser?
e.g. 3 lines before and 3 lines after match.
Thanks a lot!

@hanwen
Copy link
Contributor

hanwen commented Feb 20, 2021

I guess? It needs a bit of refactoring, because you have to coalesce the context lines for multiple consecutive matches.

@hanwen
Copy link
Contributor

hanwen commented Feb 20, 2021

I think you are asking if context lines are supported out of the box. The answer is: no.

@tlamr
Copy link
Author

tlamr commented Feb 20, 2021

Thanks @hanwen !
I believe that this would be a brilliant feature, I so far never worked with go, but I'll try to look into it.

Cheers,
T

@tlamr
Copy link
Author

tlamr commented Feb 21, 2021

So this change tlamr@65f2bb4
produces https://ibb.co/Ky2PtSZ which might be just good enough for us.

Would you @hanwen be willing to accept a patch that adds this as a parameter or would you prefer some more polished solution?

Thanks,
Tomas

@hanwen
Copy link
Contributor

hanwen commented Feb 22, 2021

no. This breaks the API contract: the segment you're returning contains a '\n'. I think it would also do the wrong thing if you have two matches on consecutive lines: you'd get some lines returned twice.

@tlamr
Copy link
Author

tlamr commented Feb 22, 2021

ok, thanks!

Cheers,
Tomas

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

No branches or pull requests

2 participants