I would like to include code that handles the situation where the user has deleted the last character in a line or especially the last character in the document. However, it seems that in some situations CodeMirror inserts a Zero Width Space character (U+200B) at the beginning of each line and in some instances it does not. doc.getValue() and getRange() results will include that character. Is the best way to determine if a line or doc is empty to test to see if getValue() is empty or if it equals the Zero Width Space character, or is there some cleaner way to do it? (it seems odd that getValue() includes that character.)
There will be zero-width spaces in the DOM, but those shouldn’t end up in the document. If you have a case where they do, that’s a bug, and I’d be interested in a set of steps to reproduce it.