Skip to content

Instantly share code, notes, and snippets.

@njx
Created February 15, 2013 22:34
Show Gist options
  • Save njx/4964129 to your computer and use it in GitHub Desktop.
Save njx/4964129 to your computer and use it in GitHub Desktop.
Subdoc tokenize bug
<!doctype html>
<html>
<head>
<title>Subdoc Tokenize Bug</title>
<link rel="stylesheet" href="lib/codemirror.css">
<script src="lib/codemirror.js"></script>
<script src="mode/css/css.js"></script>
<link rel="stylesheet" href="doc/docs.css">
<style type="text/css">
.CodeMirror {border: 1px solid black;}
</style>
</head>
<body>
<h1>Subdoc Tokenize Bug</h1>
<div id="editor"></div>
<div id="subeditor"></div>
<script id="script">
window.onload = function() {
var content = ".rule1 {\n" +
" background: #0a0a0a;\n" +
"}\n" +
"\n" +
".rule2 {\n" +
" background: #fbfbfb;\n" +
"}\n";
var editor = CodeMirror(document.getElementById("editor"), {
lineNumbers: true,
value: content,
mode: "css"
});
var subdoc = editor.getDoc().linkedDoc({sharedHist: true, from: 4, to: 7});
var subeditor = CodeMirror(document.getElementById("subeditor"), {
lineNumbers: true,
value: subdoc,
mode: "css"
});
};
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment