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

Improve unicode string handling in linkifier #1678

Merged
merged 29 commits into from Sep 14, 2018
Merged

Conversation

jerch
Copy link
Member

@jerch jerch commented Sep 9, 2018

Had to do several changes to get the cell/length offset mess working. This PR shall fix #1669.

Changes in Buffer.ts:

  • BufferStringIterator: class to get a hold of the buffer string content in a convenient way
  • Buffer.stringIndexToBufferIndex: method to translate a string index from a string retrieved by Buffer.translateBufferLineToString to get the row and cols indices in the buffer. Atm this method assumes that the string started at col 0. (Can be changed easily to respect startCol as well.)
  • Buffer.contents: return a BufferStringIterator

Changes in Linkifier.ts:

  • reimplemented _linkifyRow and _doLinkifyRow

TODO:

  • reimplement Linkifier._addLink to support unicode char offsets within a match (currently only pre/post match offsets are respected)
  • tests for unicode chars in linkifier

@alexr00 The new methods in Buffer can also fix the highlight offset problems of the selection manager. Might be worth a look once this PR can land. Seems to work now. issue created #1680 + #1686

@jerch
Copy link
Member Author

jerch commented Sep 10, 2018

Ready for review 😸

@Tyriar Tyriar changed the title Fix linkifier Improve unicode string handling in linkifier Sep 14, 2018
@Tyriar Tyriar added this to the 3.8.0 milestone Sep 14, 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.

Seems to work, the review is mainly clean up/strictness related stuff

src/Buffer.ts Outdated Show resolved Hide resolved
src/Buffer.ts Outdated Show resolved Hide resolved
src/Buffer.ts Outdated Show resolved Hide resolved
src/Buffer.ts Outdated Show resolved Hide resolved
src/Linkifier.ts Outdated Show resolved Hide resolved
src/CharWidth.ts Outdated Show resolved Hide resolved
src/CharWidth.ts Outdated Show resolved Hide resolved
src/Linkifier.ts Outdated Show resolved Hide resolved
src/Linkifier.ts Outdated Show resolved Hide resolved
src/Linkifier.ts Outdated Show resolved Hide resolved
@jerch
Copy link
Member Author

jerch commented Sep 14, 2018

@Tyriar I think I have addressed all review issues. Up for the next round 😸

Could you also test the issue from #1669 (comment) again? I think it is not related to the linkifier at all and will need separate tracking before closing the issue.

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, I checked 3.4.0 and #1669 (comment) doesn't appear to be a regression

@jerch jerch merged commit d37a8ce into xtermjs:master Sep 14, 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.

Linkifier doesn't handle some unicode strings
2 participants