Does the value returned by cm.getTokenAt(pos) (specifically string) shouldn't be stable (the string value shouldn't change its value on every call)?
Example from pl.wikipedia.org:
- Article Francisco Echevarría (link to edit in old code ditor [if not logged in] and in safemode), enable CodeMirror (pen[?] button between puzzle piece and Zaawansowane [Advanced]).
- In dev console (F12) paste and execute
var editor = $(".CodeMirror")
- Paste and execute a few (3 or more) times:
editor[0].CodeMirror.getTokenAt({line:26,ch:5})
, notice that the string property adds a new token every time - Add new line before the 26 line (before the quotes of the black name Francisco Echevarria), notice that the color of highlighting changes.
- Again execute a few times getTokenAt (with updated line to 27!), notice that the string property is stable (doesn't add new tokens)
- To restore the previous state, delete the new line (also probably backspace would be needed, to place the name line after the closing brackets of template above it)