Skip to content

Instantly share code, notes, and snippets.

@njx
Created March 20, 2012 00:38
Show Gist options
  • Save njx/2129102 to your computer and use it in GitHub Desktop.
Save njx/2129102 to your computer and use it in GitHub Desktop.
CodeMirror bug when deleting text in hidden lines
<!doctype html>
<html>
<head>
<title>CodeMirror: Hidden line bug</title>
<link rel="stylesheet" href="lib/codemirror.css">
<script src="lib/codemirror.js"></script>
<style type="text/css">
.CodeMirror {border: 1px solid black;}
</style>
</head>
<body>
<textarea id="code" name="code"></textarea>
<input type="button" onclick="editor.setValue('')" value="Clear Editor">
<script id="script">
window.onload = function() {
var te = document.getElementById("code");
te.value = "function bar() {\n var foo = 1;\n}";
window.editor = CodeMirror.fromTextArea(te, {
mode: "javascript",
lineNumbers: true
});
editor.hideLine(0);
editor.setSelection({line: 1, ch: 2}, {line: 1, ch: 2});
};
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment