Showing with 4,623 additions and 1,618 deletions.
  1. +90 −0 bin/compress
  2. +6 −3 demo/activeline.html
  3. +8 −6 demo/folding.html
  4. +7 −1 demo/theme.html
  5. +4 −0 doc/compress.html
  6. +4 −2 doc/docs.css
  7. +114 −59 doc/manual.html
  8. +8 −1 doc/realworld.html
  9. +20 −6 doc/upgrade_v3.html
  10. +41 −14 index.html
  11. +2 −1 keymap/emacs.js
  12. +263 −154 keymap/vim.js
  13. +7 −1 lib/codemirror.css
  14. +1,175 −855 lib/codemirror.js
  15. +3 −24 lib/util/closetag.js
  16. +36 −0 lib/util/continuecomment.js
  17. +60 −77 lib/util/foldcode.js
  18. +10 −7 lib/util/formatting.js
  19. +11 −11 lib/util/javascript-hint.js
  20. +4 −2 lib/util/match-highlighter.js
  21. +7 −5 lib/util/matchbrackets.js
  22. +3 −9 lib/util/pig-hint.js
  23. +6 −5 lib/util/search.js
  24. +1 −1 lib/util/simple-hint.js
  25. +2 −8 lib/util/xml-hint.js
  26. +4 −5 mode/clike/clike.js
  27. +4 −4 mode/clojure/clojure.js
  28. +1 −1 mode/coffeescript/coffeescript.js
  29. +1 −1 mode/commonlisp/commonlisp.js
  30. +0 −11 mode/ecl/ecl.js
  31. +1 −1 mode/erlang/erlang.js
  32. +2 −2 mode/gfm/gfm.js
  33. +1 −1 mode/gfm/index.html
  34. +1 −6 mode/go/go.js
  35. +1 −1 mode/groovy/groovy.js
  36. +1 −1 mode/haskell/haskell.js
  37. +13 −13 mode/haxe/haxe.js
  38. +1 −1 mode/htmlmixed/htmlmixed.js
  39. +3 −1 mode/javascript/index.html
  40. +4 −2 mode/javascript/javascript.js
  41. +1 −1 mode/jinja2/jinja2.js
  42. +0 −12 mode/markdown/markdown.js
  43. +25 −8 mode/mysql/mysql.js
  44. +0 −2 mode/ntriples/ntriples.js
  45. +1 −2 mode/ocaml/ocaml.js
  46. +2 −2 mode/pascal/pascal.js
  47. +1 −1 mode/perl/perl.js
  48. +1 −0 mode/php/index.html
  49. +16 −36 mode/php/php.js
  50. +3 −4 mode/pig/pig.js
  51. +3 −4 mode/plsql/plsql.js
  52. +6 −4 mode/python/python.js
  53. +1 −1 mode/r/r.js
  54. +1 −1 mode/rpm/changes/changes.js
  55. +1 −1 mode/rpm/spec/spec.js
  56. +0 −2 mode/rst/rst.js
  57. +1 −1 mode/ruby/ruby.js
  58. +3 −3 mode/rust/rust.js
  59. +4 −4 mode/scheme/scheme.js
  60. +1 −1 mode/shell/shell.js
  61. +1 −1 mode/sieve/sieve.js
  62. +2 −2 mode/smalltalk/smalltalk.js
  63. +1 −1 mode/smarty/smarty.js
  64. +2 −2 mode/sparql/sparql.js
  65. +6 −13 mode/stex/stex.js
  66. +6 −37 mode/tiddlywiki/tiddlywiki.js
  67. +3 −3 mode/tiki/tiki.js
  68. +3 −3 mode/vb/vb.js
  69. +2 −4 mode/velocity/velocity.js
  70. +1 −13 mode/verilog/verilog.js
  71. +1 −1 mode/xml/index.html
  72. +5 −3 mode/xml/xml.js
  73. +3 −4 mode/xquery/xquery.js
  74. +39 −0 mode/z80/index.html
  75. +113 −0 mode/z80/z80.js
  76. +1 −1 package.json
  77. +1,593 −0 test/lint/acorn.js
  78. +69 −85 test/lint/lint.js
  79. +216 −0 test/lint/walk.js
  80. +2 −1 test/phantom_driver.js
  81. +312 −49 test/test.js
  82. +6 −0 theme/ambiance-mobile.css
  83. +2 −2 theme/ambiance.css
  84. +207 −0 theme/solarized.css
  85. +26 −0 theme/twilight.css
90 changes: 90 additions & 0 deletions bin/compress
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
#!/usr/bin/env node

// Compression helper for CodeMirror
//
// Example:
//
// bin/compress codemirror runmode javascript xml
//
// Will take lib/codemirror.js, lib/util/runmode.js,
// mode/javascript/javascript.js, and mode/xml/xml.js, run them though
// the online minifier at http://marijnhaverbeke.nl/uglifyjs, and spit
// out the result.
//
// bin/compress codemirror --local /path/to/bin/UglifyJS
//
// Will use a local minifier instead of the online default one.
//
// Script files are specified without .js ending. Prefixing them with
// their full (local) path is optional. So you may say lib/codemirror
// or mode/xml/xml to be more precise. In fact, even the .js suffix
// may be speficied, if wanted.

"use strict";

var fs = require("fs");

function help(ok) {
console.log("usage: " + process.argv[1] + " [--local /path/to/uglifyjs] files...");
process.exit(ok ? 0 : 1);
}

var local = null, args = null, files = [], blob = "";

for (var i = 2; i < process.argv.length; ++i) {
var arg = process.argv[i];
if (arg == "--local" && i + 1 < process.argv.length) {
var parts = process.argv[++i].split(/\s+/);
local = parts[0];
args = parts.slice(1);
} else if (arg == "--help") {
help(true);
} else if (arg[0] != "-") {
files.push({name: arg, re: new RegExp("(?:\\/|^)" + arg + (/\.js$/.test(arg) ? "$" : "\\.js$"))});
} else help(false);
}

function walk(dir) {
fs.readdirSync(dir).forEach(function(fname) {
if (/^[_\.]/.test(fname)) return;
var file = dir + fname;
if (fs.statSync(file).isDirectory()) return walk(file + "/");
if (files.some(function(spec, i) {
var match = spec.re.test(file);
if (match) files.splice(i, 1);
return match;
})) {
if (local) args.push(file);
else blob += fs.readFileSync(file, "utf8");
}
});
}

walk("lib/");
walk("mode/");

if (!blob) help(false);

if (files.length) {
console.log("Some speficied files were not found: " +
files.map(function(a){return a.name;}).join(", "));
process.exit(1);
}

if (local) {
require("child_process").spawn(local, args, {stdio: ["ignore", process.stdout, process.stderr]});
} else {
var data = new Buffer("js_code=" + require("querystring").escape(blob), "utf8");
var req = require("http").request({
host: "marijnhaverbeke.nl",
port: 80,
method: "POST",
path: "/uglifyjs",
headers: {"content-type": "application/x-www-form-urlencoded",
"content-length": data.length}
});
req.on("response", function(resp) {
resp.on("data", function (chunk) { process.stdout.write(chunk); });
});
req.end(data);
}
9 changes: 6 additions & 3 deletions demo/activeline.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,13 @@ <h1>CodeMirror: Active Line Demo</h1>
lineNumbers: true,
lineWrapping: true
});
var hlLine = editor.setLineClass(0, null, "activeline");
var hlLine = editor.addLineClass(0, "background", "activeline");
editor.on("cursorActivity", function() {
editor.setLineClass(hlLine, null, null);
hlLine = editor.setLineClass(editor.getCursor().line, null, "activeline");
var cur = editor.getLineHandle(editor.getCursor().line);
if (cur != hlLine) {
editor.removeLineClass(hlLine, "background", "activeline");
hlLine = editor.addLineClass(cur, "background", "activeline");
}
});
</script>

Expand Down
14 changes: 8 additions & 6 deletions demo/folding.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,13 @@

<style type="text/css">
.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
.CodeMirror-folded {width: .8em;}
.CodeMirror-foldmarker {color:#600; font-size: 80%;}
.CodeMirror-foldmarker {
color: blue;
text-shadow: #b9f 1px 1px 2px, #b9f -1px -1px 2px, #b9f 1px -1px 2px, #b9f -1px 1px 2px;
font-family: arial;
line-height: .3;
cursor: pointer;
}
</style>
</head>
<body>
Expand All @@ -40,25 +45,22 @@ <h1>CodeMirror: Code Folding Demo</h1>
window.editor = CodeMirror.fromTextArea(te, {
mode: "javascript",
lineNumbers: true,
gutters: ["CodeMirror-linenumbers", "CodeMirror-folded"],
lineWrapping: true,
extraKeys: {"Ctrl-Q": function(cm){foldFunc(cm, cm.getCursor().line);}}
});
editor.on("gutterClick", foldFunc);
foldFunc(editor, 9);
foldFunc(editor, 20);

var foldFunc_html = CodeMirror.newFoldFunction(CodeMirror.tagRangeFinder);
window.editor_html = CodeMirror.fromTextArea(te_html, {
mode: "text/html",
lineNumbers: true,
gutters: ["CodeMirror-linenumbers", "CodeMirror-folded"],
lineWrapping: true,
extraKeys: {"Ctrl-Q": function(cm){foldFunc_html(cm, cm.getCursor().line);}}
});
editor_html.on("gutterClick", foldFunc_html);
foldFunc_html(editor_html, 11);
foldFunc_html(editor_html, 1);
foldFunc_html(editor_html, 15);
};
</script>
</body>
Expand Down
8 changes: 7 additions & 1 deletion demo/theme.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
<link rel="stylesheet" href="../theme/ambiance.css">
<link rel="stylesheet" href="../theme/blackboard.css">
<link rel="stylesheet" href="../theme/vibrant-ink.css">
<link rel="stylesheet" href="../theme/solarized.css">
<link rel="stylesheet" href="../theme/twilight.css">
<script src="../mode/javascript/javascript.js"></script>
<link rel="stylesheet" href="../doc/docs.css">

Expand Down Expand Up @@ -55,6 +57,9 @@ <h1>CodeMirror: Theme demo</h1>
<option>neat</option>
<option>night</option>
<option>rubyblue</option>
<option>solarized dark</option>
<option>solarized light</option>
<option>twilight</option>
<option>vibrant-ink</option>
<option>xq-dark</option>
</select>
Expand All @@ -69,7 +74,8 @@ <h1>CodeMirror: Theme demo</h1>
var theme = input.options[input.selectedIndex].innerHTML;
editor.setOption("theme", theme);
}
var choice = document.location.search && document.location.search.slice(1);
var choice = document.location.search &&
decodeURIComponent(document.location.search.slice(1));
if (choice) {
input.value = choice;
editor.setOption("theme", choice);
Expand Down
4 changes: 4 additions & 0 deletions doc/compress.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,11 @@ <h1><span class="logo-braces">{ }</span> <a href="http://codemirror.net/">CodeMi
<input type="hidden" id="download" name="download" value="codemirror-compressed.js"/>
<p>Version: <select id="version" onchange="setVersion(this);" style="padding: 1px">
<option value="http://codemirror.net/">HEAD</option>
<option value="http://marijnhaverbeke.nl/git/codemirror?a=blob_plain;hb=v3.0rc1;f=">3.0rc1</option>
<option value="http://marijnhaverbeke.nl/git/codemirror?a=blob_plain;hb=v3.0beta2;f=">3.0beta2</option>
<option value="http://marijnhaverbeke.nl/git/codemirror?a=blob_plain;hb=v3.0beta1;f=">3.0beta1</option>
<option value="http://marijnhaverbeke.nl/git/codemirror?a=blob_plain;hb=v2.36;f=">2.36</option>
<option value="http://marijnhaverbeke.nl/git/codemirror?a=blob_plain;hb=v2.35;f=">2.35</option>
<option value="http://marijnhaverbeke.nl/git/codemirror?a=blob_plain;hb=v2.34;f=">2.34</option>
<option value="http://marijnhaverbeke.nl/git/codemirror?a=blob_plain;hb=v2.33;f=">2.33</option>
<option value="http://marijnhaverbeke.nl/git/codemirror?a=blob_plain;hb=v2.32;f=">2.32</option>
Expand Down Expand Up @@ -114,6 +117,7 @@ <h1><span class="logo-braces">{ }</span> <a href="http://codemirror.net/">CodeMi
<option value="http://codemirror.net/mode/xml/xml.js">xml.js</option>
<option value="http://codemirror.net/mode/xquery/xquery.js">xquery.js</option>
<option value="http://codemirror.net/mode/yaml/yaml.js">yaml.js</option>
<option value="http://codemirror.net/mode/z80/z80.js">z80.js</option>
</optgroup>
<optgroup label="Utilities and add-ons">
<option value="http://codemirror.net/lib/util/overlay.js">overlay.js</option>
Expand Down
6 changes: 4 additions & 2 deletions doc/docs.css
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ a.download:hover {
}

.left {
width: 37em;
margin-right: 20.68em;
max-width: 37em;
padding-right: 6.53em;
padding-bottom: 1em;
}
Expand All @@ -134,11 +135,12 @@ a.download:hover {
}

.left2 {
width: 15.24em;
max-width: 15.24em;
}

.right {
width: 20.68em;
margin-left: -20.68em;
}

.leftbig {
Expand Down
Loading