I updated the same script https://glitch.com/edit/#!/clever-slender-basil?path=index.js%3A1%3A0
Sadly it is not as simple as I would like but this is the best reproducible one I could come up with.
The interesting bits:
- In this case the mix of plugins/Simultaneous addition of decorations is required. If I comment out visibleSpaces plugin the bug does not occur.
- For the bug to happen it requires a setMeta to be triggered, if I use the previous approach that only triggers on docChanged it works fine.
- This time to reproduce we just need to put our cursor at the end of the textarea, no typing required, the infinite loop of appendMistake will change the position of the cursor on its own.