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

fix overscan issue and enable linkifier on partial shown matches #1693

Merged
merged 9 commits into from Sep 26, 2018

Conversation

jerch
Copy link
Member

@jerch jerch commented Sep 14, 2018

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 attribute LIMIT_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? Changed to class attribute LIMIT_CHAR_OVERSCAN = 2000, that does the overscan based on the actual terminal width.

@Tyriar
Copy link
Member

Tyriar commented Sep 14, 2018

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.

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 (Math.ceil(charCount / cols) rows).

@jerch
Copy link
Member Author

jerch commented Sep 14, 2018

Right x chars before and after will do and automagically deal with different buffer widths. 👍

@jerch
Copy link
Member Author

jerch commented Sep 14, 2018

According this informed SO post URLs longer than 2k are not widely supported, therefore I changed the overscan limit to 2000 characters.

@jerch jerch self-assigned this Sep 14, 2018
@jerch
Copy link
Member Author

jerch commented Sep 18, 2018

@Tyriar: Ready for next review. Lemme know if something is still missing.

@Tyriar Tyriar closed this Sep 21, 2018
@Tyriar Tyriar reopened this Sep 21, 2018
@jerch
Copy link
Member Author

jerch commented Sep 22, 2018

@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.

@jerch jerch closed this Sep 24, 2018
@jerch jerch reopened this Sep 24, 2018
Copy link
Member

@Tyriar Tyriar left a 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/Buffer.test.ts Show resolved Hide resolved
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sz -> sc

@Tyriar Tyriar added this to the 3.8.0 milestone Sep 26, 2018
@jerch
Copy link
Member Author

jerch commented Sep 26, 2018

@Tyriar Thx alot ❤️

@jerch jerch merged commit 21f3534 into xtermjs:master Sep 26, 2018
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

Successfully merging this pull request may close these issues.

None yet

2 participants