Open diminutivesloop opened 1 year ago
I suspect this is related to the problem that atomic ranges does not work in the normal mode.
https://forum.obsidian.md/t/cm6-are-vim-mode-atomic-ranges-compatible/69667
I think I figured out why it happens. CM6's moveByChar skips atoms (https://github.com/codemirror/view/blob/e6a55a6515521a84e709f02b4eb32e57aebbbfba/src/editorview.ts#L641), while codemirror-vim's moveByCharacters doesn't.
I was able to fix this regarding cursor motions (h
/l
) by modifying the implementation of moveByCharacters()
so that is uses CM6's moveByChar
(which respects atomic ranges).
https://github.com/RyotaUshio/codemirror-vim/commit/e6eb8dbc18fb7e1175d370e0e3d7d163be2db998
But I'm not sure how I can fix this regarding deletion.
Base CM forward deletes atomically, while backspace deletes the characters separately. I wonder if there's code from base CM that could be referenced to atomically delete.
@RyotaUshio, would it make sense to submit the motion patch as a PR ahead of figuring out the deletion part?
@firai I might make sense, but to be honest, I currently can't find enough time to fill in the (a little bit strict) PR template.
Obsidian has recently released v1.5.3, which includes the fix for this problem.
@RyotaUshio I checked the latest version and it resolves the issue except in the case where the emoji is at the end of the line. In that case the cursor still moves twice over the emoji character and disappears when at the very end of the line.
Originally reported as an issue w/ Obsidian.
Steps to Reproduce
Using sandbox editor:
Expected result
The cursor moves over the emoji just like non-emoji text.
Actual result
After initially highlighting the emoji character, the cursor disappears on its next move (or next several depending on the number of codepoints) and eventually reappears once it is moved to the subsequent character.
https://github.com/replit/codemirror-vim/assets/121306735/62d95347-a2a4-499a-8895-f36ec20078b5