Block cursor text rendering issue on Safari

It seems codemirror-vim is maintained by replit and I should not be asking here. However I found their block cursor implementation is pretty straightforward, the text position is calculated by relying on view.coordsAtPos, it seems doesn’t work very well on Safari.

Could you please check details described in this issue? [Bug] Block cursor text rendering issue on Safari · Issue #118 · replit/codemirror-vim · GitHub

I appreciate if you can think of something that might be related, thanks.

FWIW, a few months ago, I tried a layer-based approach for drawing invisible characters (mainly because the current invisible drawing breaks auto corrections provided by the system, as it creates spans), and noticed similar things. I cannot always make the invisible aligned with other text elements, I used view.coordsAtPos too.

It seems also reproducible with the Try CodeMirror demo, the position of text selection is not 100% accurate.

Safari:

image

Chrome:

@marijn do you have any ideas? Thanks.