Skip to content

Conversation

@dummdidumm
Copy link
Member

If a range is in the same line, and the mapped range has one character more than the original range, add +1 to the end character of the original range.
Assumption is that we never alter the length of a mapped token.

This "one character short" mapping happens because a range's end is exclusive, so the character at the range's end is not part of the range. That means the end character can be on a character which was added as part of the transformation and is not present in the original output. The mapper rightfully maps this to the first mapped character before it - which means that the range then is one character short.

#762

If a range is in the same line, and the mapped range has one character more than the original range, add +1 to the end character of the original range.
Assumption is that we never alter the length of a mapped token.

This "one character short" mapping happens because a range's end is exclusive, so the character at the range's end is not part of the range. That means the end character can be on a character which was added as part of the transformation and is not present in the original output. The mapper rightfully maps this to the first mapped character before it - which means that the range then is one character short.

sveltejs#762
@dummdidumm dummdidumm merged commit a9f40e3 into sveltejs:master Jan 26, 2021
@dummdidumm dummdidumm deleted the fix-range-mapping branch January 26, 2021 12:57
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.

1 participant