tools icon indicating copy to clipboard operation
tools copied to clipboard

🐛 Emdash crashes rome

Open imownbey opened this issue 3 years ago • 1 comments

Environment information

This also seems to happen in the playground, but happens with Rome 10.1 and React Native

What happened?

  1. Go to playground
  2. Type "<Text>Try it – <Text>7 Days</Text> for free!</Text>" (note the dash is an emdash)
  3. Save. Playground will go blank and rome will crash or move around text incorrectly. Playground link: https://docs.rome.tools/playground/?code=PABUAGUAeAB0AD4AVAByAHkAIABpAHQAIAATICAAUABsAGEAeQAgADwAPAAvAFQAZQB4AHQAPgA%3D

Expected result

It should just treat emdashes normally

Code of Conduct

  • [X] I agree to follow Rome's Code of Conduct

imownbey avatar Nov 16 '22 17:11 imownbey

There are two similar but separate issue here related to the handling of character positions in UTF-8 strings as byte offset, for Rome itself I can't reproduce the issue on the latest nightly so this was probably fixed by #3745, while for the playground the exception is thrown by CodeMirror as we provide invalid positions for the diagnostics here: https://github.com/rome/tools/blob/ce16cb8212de802b192eb8710577275e009d576f/website/src/playground/CodeMirror.tsx#L61-L62

leops avatar Nov 17 '22 09:11 leops

This should be fixed

ematipico avatar May 08 '23 13:05 ematipico