zedapp / zed

Rethinking code editing.
http://zedapp.org
MIT License
2.22k stars 162 forks source link

Minor Unicode handling bugs #518

Open ghost opened 9 years ago

ghost commented 9 years ago

For the most art, your unicode support is actually really good ;-) I can open, view, and save unicode correctly, congrats!

There's a few minor issues though, mostly to do with the positioning of the cursor than anything else. These bugs might not even be Zed bugs, they might actually be in Ace itself. I'm not sure.

You should download this file:

http://www.cl.cam.ac.uk/~mgk25/ucs/examples/UTF-8-demo.txt

And attempt to edit it in Zed. The vast majority of it renders correctly, and that's excellent. The problems can be divided into two types:

  1. Character-width bugs. Somewhere along the line, somebody wrote some code that assumes one byte == one character, and that's true for ASCII but it's not true in UTF-8. To see this, find a section of that document containing multi-byte characters, such as Georgian, Thai, Ethiopian, Braille, etc, and try this experiment: select a few letters near the end of a line, and delete them. You'll find that a) The characters that got deleted were different ones than the ones that appeared in the selection, and b) when you attempt to place the cursor at the end of the line, it doesn't appear in the place you expect it to (however typing End followed by Backspace does correctly delete the last letter of the line, despite the cursor appearing in the wrong place).
  2. Box drawing misalignment. The mathematical formula near the beginning of the document, and also the Box drawing test at the end of the document are all horribly misaligned. This should probably be better, especially considering that this is a text editor where every character is ostensibly fixed-with ;-)

So like I say, I'm not sure if this is a zed bug or an ace bug. depends exactly where the cursor display and text selection code lives, I'm not familiar with that stuff.