I have a really weird bug, in all browser, with my integration of CodeMirror. For some mysterious reason, the first character isn’t highlighted when I use the selectAll command or when I select it by mouse or by keyboard.
I know it is in my integration in my tool since in another context, I have the proper behavior. But I have no clue what to look for so any pointer would be welcome!
Are you creating any marked ranges with
markText? That could have such an effect, if you make the first character an atomic, inclusiveLeft range.
Other than that, nothing comes to mind. Gradually remove pieces that might interfere with the editor, and see at which point the problem goes away.
Thanks for the pointer, but no, I’m not using markText, I’m just calling selectAll on focus otherwise I let CM manage the selection. It is not even the full first character, just part of it! If I ask what is the selection to CM, it correctly return the full sentence so it is really a visual quirk.
When I find it, I’ll be sure to update that thread.
Could it be that you adjusted the page layout, or a font loaded, after initializing the editor? If so, make sure to call
refresh() on it when the layout stabilizes, since it’ll end up using outdated pixel measurements.
That was a good thought and I even had a problem with that earlier, but I’m already doing the refresh after a slight delay to make sure everything is properly loaded. I tried to augment the delay with no luck. Thanks for the pointer!