coordsAt(pos, 1)
works in most cases, but if widget is added with side=1
coordsAtPos
always returns left coordinate of widget’s boundary instead of the letter after the widget.
This is needed, for example, to position block cursor over the character.
The issue can be seen at https://raw.githack.com/replit/codemirror-vim/widget-test/dev/web-demo.html by positioning cursor after a widget with text 1
marijn
July 30, 2023, 3:14pm
2
There is now, as of this patch. Does that look like the interface you need?
committed 03:13PM - 30 Jul 23 UTC
FEATURE: The new `EditorView.coordsForChar` method returns the client rectangle … for a
given character in the editor.
See https://discuss.codemirror.net/t/is-there-a-way-to-get-left-coordinate-of-a-character/6891
Thank you, this covers my usecase.
marijn
July 31, 2023, 8:02pm
4
Released this as part of 6.16.0