Skip to content

Instantly share code, notes, and snippets.

@njx
Created April 5, 2012 06:57
Show Gist options
  • Save njx/2308587 to your computer and use it in GitHub Desktop.
Save njx/2308587 to your computer and use it in GitHub Desktop.
Select all bug with hidden lines
<!doctype html>
<html>
<head>
<title>Hidden line/undo bug</title>
<link rel="stylesheet" href="codemirror.css">
<script src="codemirror.js"></script>
<style type="text/css">
.CodeMirror {border: 1px solid black;}
</style>
</head>
<body>
<form><textarea id="code" name="code">
Hidden line
Hidden line
Hidden line
Hidden line
Unhidden line
Hidden line
Hidden line
Hidden line
Hidden line</textarea></form>
Click at the end of the line above, then hit Ctrl/Cmd-A to select all.
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
lineNumbers: true
});
function doHide(start, end) {
for (var i = start; i <= end; i++)
editor.hideLine(i);
}
doHide(0, 3);
doHide(5, 8);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment