Skip to content

Instantly share code, notes, and snippets.

@njx
Created January 24, 2013 21:50
Show Gist options
  • Save njx/4628208 to your computer and use it in GitHub Desktop.
Save njx/4628208 to your computer and use it in GitHub Desktop.
CodeMirror line widget noHScroll bug as of e8c7955. Resize the window small so that the editor starts to resize, then try to scroll horizontally--the line widget scrolls even though noHScroll is set. Reproduced on Mac Chrome.
<!doctype html>
<html>
<head>
<title>NoHScroll Bug</title>
<link rel="stylesheet" href="lib/codemirror.css">
<script src="lib/codemirror.js"></script>
<link rel="stylesheet" href="doc/docs.css">
<style type="text/css">
.CodeMirror {border: 1px solid black;}
</style>
</head>
<body>
<h1>NoHScroll Bug</h1>
<div id="editor"></div>
<script id="script">
window.onload = function() {
var content = "";
for (var i = 0; i < 10; i++) {
content += "Line " + i + " ====================================================================================================================================================================" + "\n";
}
window.editor = CodeMirror(document.getElementById("editor"), {
lineNumbers: true,
value: content
});
window.widgetNode = document.createElement("div");
window.widgetNode.style.backgroundColor = "#666666";
window.widgetNode.style.height = "100px";
window.widgetNode.innerHTML = "Text inside widget";
window.lineWidget = editor.addLineWidget(1, window.widgetNode, { noHScroll: true });
};
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment