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.
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.
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.
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.