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(core): fix decoration offset edge cases #728

Merged
merged 2 commits into from
Jul 26, 2024

Conversation

timothycohen
Copy link
Contributor

Description

Fixes edge cases in the Decorations API.

Linked Issues

Fix #719 (when offset === code.length)
Fix #727 (when end.line < start.line but end.offset > start.offset)

Additional context

It's recoverable when end.line < start.line if the offsets are okay. But because of the test explicitly checking that the chars don't overflow the line, I followed suit and threw instead of manipulating the line/character.

Copy link

netlify bot commented Jul 25, 2024

Deploy Preview for shiki-matsu ready!

Name Link
🔨 Latest commit eb5f57e
🔍 Latest deploy log https://app.netlify.com/sites/shiki-matsu/deploys/66a2d4457fcb8c0008bbe451
😎 Deploy Preview https://deploy-preview-728--shiki-matsu.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Jul 25, 2024

Deploy Preview for shiki-next ready!

Name Link
🔨 Latest commit eb5f57e
🔍 Latest deploy log https://app.netlify.com/sites/shiki-next/deploys/66a2d44535cc130008f49ff1
😎 Deploy Preview https://deploy-preview-728--shiki-next.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@timothycohen timothycohen changed the title Decorations api fix fix(core): fix decoration offset edge cases Jul 26, 2024
@antfu antfu merged commit 1349bb4 into shikijs:main Jul 26, 2024
10 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants