-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
fix overscan issue and enable linkifier on partial shown matches #1693
Conversation
Why not just ballpark some number and accept the few failures that may occur? For example, scan 5 rows up or down, or maybe better scan x characters up or down ( |
Right x chars before and after will do and automagically deal with different buffer widths. 👍 |
According this informed SO post URLs longer than 2k are not widely supported, therefore I changed the overscan limit to 2000 characters. |
@Tyriar: Ready for next review. Lemme know if something is still missing. |
@Tyriar Ready for next review. I added range checks and a brute force test to be on the safe side. The iterator should not overflow the buffer for any argument now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍 sorry about the delay
src/Linkifier.ts
Outdated
// _doLinkifyRow gets full unwrapped lines with the start row as buffer offset | ||
// for every matcher. | ||
// The unwrapping is needed to also match content that got wrapped across | ||
// several buffer lines. To avoid a worst case szenario where the whole buffer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sz -> sc
@Tyriar Thx alot ❤️ |
Fixes #1691.
@Tyriar I actually had to move the overscan ability to
BufferStringIterator
to deal with a possible worst case scenario where the buffer contains very very long unwrapped lines.This might also be a problem at other places that try to unwrap line data.
The linkifier now has a class attributeChanged to class attributeLIMIT_OVERSCAN = 5
that allows to expand the unwrapping to a maximum of -5 for the top and +5 for the bottom viewport border. I think we want this value to be customizable or changeable at runtime, since it kinda limits any match at the borders to that size (an URI taking 6 lines will not match at the borders), which will lead to problems in small terminals. Not sure where to put this, maybe in the buffer class itself as an default overscan value, that changes with different buffer widths?LIMIT_CHAR_OVERSCAN = 2000
, that does the overscan based on the actual terminal width.