zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
46.88k stars 2.68k forks source link

The string length calculation is incorrect. #14196

Open kovdmit opened 2 months ago

kovdmit commented 2 months ago

Check for existing issues

Describe the bug / provide steps to reproduce it

The string length is considered correct if the string uses Latin characters. However, if the string contains Cyrillic characters, each such character is counted as two.

Environment

Ubuntu 24.04

If applicable, add mockups / screenshots to help explain present your vision of the feature

No response

If applicable, attach your Zed.log file to this issue.

Zed.log


JosephTLyons commented 2 months ago

Hey @kovdmit, what's happening here is that Zed is actually calculating the bytes in the selection and not the characters, which is why your characters are showing as 2. We probably should do something here to signal bytes, rather than characters, or change it to true characters.