replit / codemirror-vim

Vim keybindings for CM6
https://www.npmjs.com/package/@replit/codemirror-vim
MIT License
310 stars 30 forks source link

[Bug] Block cursor text rendering issue on Safari #118

Open cyanzhong opened 1 year ago

cyanzhong commented 1 year ago

Hello folks, thanks for making this! I've been trying to integrate vim mode to my little app MarkEdit and discovered this bug.

Since I am working on a native macOS app, I use Safari as the browser to load the editor, please check this video.

https://user-images.githubusercontent.com/6745066/234472078-1aabf9b6-65cc-44b5-8bb3-a1e9c212e6f4.mov

As I move the cursor, the character rendered on the block cursor doesn't perfectly match the main editor. Interestingly, not all characters can reproduce this, in this example video, the { character works fine.

I am not sure if it has something to do with the coordsAtPos method in CodeMirror or not, and I am trying to investigate the root cause. It could also be a font issue on Safari, since I was not able to reproduce using Chrome.

Opening an issue here to track and in case you have some ideas. Thanks.

cyanzhong commented 1 year ago

Looking into this screenshot closely, I think it's related to coordAtPos:

image
cyanzhong commented 1 year ago

Opened a thread in codemirror forums too: https://discuss.codemirror.net/t/block-cursor-text-rendering-issue-on-safari/6371 it seems normal text selection also has the same problem.

Here's also an issue in codemirror/dev repo: https://github.com/codemirror/dev/issues/1149.