Skip to content

Instantly share code, notes, and snippets.

@peterflynn
Last active September 3, 2015 07:49
Show Gist options
  • Select an option

  • Save peterflynn/0f6cd0af22edb543f56f to your computer and use it in GitHub Desktop.

Select an option

Save peterflynn/0f6cd0af22edb543f56f to your computer and use it in GitHub Desktop.
Testcase to repro Brackets bug #10590
<!doctype html>
<html>
<head>
<title>CodeMirror line widget / wordwrap issue</title>
<script src="http://codemirror.net/lib/codemirror.js"></script>
<link rel="stylesheet" href="http://codemirror.net/lib/codemirror.css">
<style type="text/css">
.CodeMirror {
margin: 0;
border: 0;
width: 100%;
}
.CodeMirror .CodeMirror {
height: auto;
width: 100%;
background-color: lightgray;
}
</style>
</head>
<body>
<div id="code"></div>
<script>
// Set up the outer CodeMirror instance
var content = "";
for (var i = 1; i <= 250; i++) {
content += "line " + i + "\n";
}
var hostEditor = CodeMirror(document.getElementById("code"), {
lineNumbers: true,
dragDrop: true,
mode: "html",
value: content
});
hostEditor.setSize(null, 600);
// Add a line widget containing a nested CodeMirror instance
var inlineContent = "";
for (var i = 1; i <= 15; i++) {
inlineContent += "inline line " + i + "\n";
}
var container = document.createElement("div");
var inlineEditor = CodeMirror(container, {
lineNumbers: true,
dragDrop: true,
mode: "html",
value: inlineContent
});
var lineWidget = hostEditor.addLineWidget(60, container, {
coverGutter: true
});
inlineEditor.refresh();
</script>
</body>
</html>
@peterflynn
Copy link
Copy Markdown
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment