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.

It’s been a while and I find this still presents. @marijn Do you have any insights? I would like to understand if it is a browser issue. Thank you!

There’s no guarantee of pixel-perfect rendering provided by the library. Browsers will do odd things with rounding, especially on scaled/zoomed stuff, and there’s not much we can do about that.

1 Like

Thank you for the response, Marijn. I guess it is possible to improve the way block cursor is drawn to work around this issue, I will take a look that instead.