nst.setCursor(cursor.to());
                    cursor.replace('');
                }
            });

            CMsettings.config.value = html;

            // Instantiante CodeMirror:
            codemirror = CodeMirror(document.body, CMsettings.config);
            codemirror.isDirty = false;
            codemirror.on('change', function (inst) {
                inst.isDirty = true;
            });
        }

        function findDepth(haystack, needle) {
            "use strict";

            var idx =