Showing with 975 additions and 302 deletions.
  1. +6 −0 AUTHORS
  2. +8 −4 addon/dialog/dialog.js
  3. +1 −1 addon/display/rulers.js
  4. +1 −1 addon/edit/continuelist.js
  5. +0 −1 addon/fold/foldgutter.css
  6. +1 −1 addon/fold/foldgutter.js
  7. +7 −0 addon/hint/xml-hint.js
  8. +3 −1 addon/selection/active-line.js
  9. +3 −2 addon/tern/tern.js
  10. +4 −2 bin/release
  11. +1 −0 bower.json
  12. +1 −1 demo/lint.html
  13. +3 −3 demo/markselection.html
  14. +0 −1 demo/matchtags.html
  15. +1 −1 demo/widget.html
  16. +2 −0 doc/compress.html
  17. +1 −1 doc/docs.css
  18. +6 −5 doc/manual.html
  19. +8 −3 doc/realworld.html
  20. +13 −0 doc/releases.html
  21. +1 −1 doc/reporting.html
  22. +1 −1 index.html
  23. +301 −88 keymap/vim.js
  24. +29 −0 lib/codemirror.css
  25. +131 −94 lib/codemirror.js
  26. +6 −6 mode/clike/clike.js
  27. +1 −1 mode/coffeescript/index.html
  28. +3 −3 mode/css/css.js
  29. +1 −1 mode/cypher/cypher.js
  30. +29 −9 mode/javascript/javascript.js
  31. +9 −1 mode/javascript/test.js
  32. +3 −1 mode/python/python.js
  33. +1 −1 mode/r/index.html
  34. +1 −1 package.json
  35. +83 −11 test/test.js
  36. +248 −52 test/vim_test.js
  37. +4 −0 theme/3024-day.css
  38. +3 −0 theme/3024-night.css
  39. +4 −1 theme/ambiance.css
  40. +2 −0 theme/base16-dark.css
  41. +2 −0 theme/base16-light.css
  42. +2 −0 theme/blackboard.css
  43. +2 −0 theme/cobalt.css
  44. +2 −0 theme/erlang-dark.css
  45. +2 −0 theme/lesser-dark.css
  46. +4 −2 theme/mbo.css
  47. +2 −0 theme/midnight.css
  48. +2 −0 theme/monokai.css
  49. +3 −0 theme/neo.css
  50. +2 −0 theme/night.css
  51. +2 −0 theme/paraiso-dark.css
  52. +2 −0 theme/paraiso-light.css
  53. +2 −0 theme/pastel-on-dark.css
  54. +2 −0 theme/rubyblue.css
  55. +3 −0 theme/solarized.css
  56. +2 −0 theme/the-matrix.css
  57. +2 −0 theme/tomorrow-night-eighties.css
  58. +2 −0 theme/twilight.css
  59. +2 −0 theme/vibrant-ink.css
  60. +2 −0 theme/xq-dark.css
6 changes: 6 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Albert Xing
Alexander Pavlov
Alexander Schepanovski
Alexander Solovyov
Alexandre Bique
alexey-k
Alex Piggott
Amsul
Expand Down Expand Up @@ -61,10 +62,12 @@ borawjm
Brandon Frohs
Brandon Wamboldt
Brett Zamir
Brian Grinstead
Brian Sletten
Bruce Mitchener
Chandra Sekhar Pydi
Charles Skelton
Cheah Chu Yeow
Chris Coyier
Chris Granger
Chris Houseknecht
Expand Down Expand Up @@ -215,6 +218,7 @@ Manuel Rego Casasnovas
Marat Dreizin
Marco Aurélio
Marco Munizaga
Marcus Bointon
Marijn Haverbeke
Mario Pietsch
Mark Lentczner
Expand All @@ -224,6 +228,7 @@ Martín Gaitán
Martin Hasoň
Mason Malone
Mateusz Paprocki
Mathias Bynens
mats cronqvist
Matthew Beale
Matthias BUSSONNIER
Expand Down Expand Up @@ -277,6 +282,7 @@ Pavel Feldman
Pavel Strashkin
Paweł Bartkiewicz
peteguhl
Peter Flynn
peterkroon
Peter Kroon
prasanthj
Expand Down
12 changes: 8 additions & 4 deletions addon/dialog/dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,14 @@
closeNotification(this, null);
var dialog = dialogDiv(this, template, options && options.bottom);
var closed = false, me = this;
function close() {
if (closed) return;
closed = true;
dialog.parentNode.removeChild(dialog);
function close(newVal) {
if (typeof newVal == 'string') {
inp.value = newVal;
} else {
if (closed) return;
closed = true;
dialog.parentNode.removeChild(dialog);
}
}
var inp = dialog.getElementsByTagName("input")[0], button;
if (inp) {
Expand Down
2 changes: 1 addition & 1 deletion addon/display/rulers.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
col = conf;
} else {
col = conf.column;
if (conf.className) elt.className = " " + conf.className;
if (conf.className) elt.className += " " + conf.className;
if (conf.color) elt.style.borderColor = conf.color;
if (conf.lineStyle) elt.style.borderLeftStyle = conf.lineStyle;
if (conf.width) elt.style.borderLeftWidth = conf.width;
Expand Down
2 changes: 1 addition & 1 deletion addon/edit/continuelist.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
})(function(CodeMirror) {
"use strict";

var listRE = /^(\s*)([*+-]|(\d+)\.)(\s*)/,
var listRE = /^(\s*)([*+-]|(\d+)\.)(\s+)/,
unorderedBullets = "*+-";

CodeMirror.commands.newlineAndIndentContinueMarkdownList = function(cm) {
Expand Down
1 change: 0 additions & 1 deletion addon/fold/foldgutter.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
}
.CodeMirror-foldgutter-open,
.CodeMirror-foldgutter-folded {
color: #555;
cursor: pointer;
}
.CodeMirror-foldgutter-open:after {
Expand Down
2 changes: 1 addition & 1 deletion addon/fold/foldgutter.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
function marker(spec) {
if (typeof spec == "string") {
var elt = document.createElement("div");
elt.className = spec;
elt.className = spec + " CodeMirror-guttermarker-subtle";
return elt;
} else {
return spec.cloneNode(true);
Expand Down
7 changes: 7 additions & 0 deletions addon/hint/xml-hint.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,16 @@
if (typeof atValues == 'function') atValues = atValues.call(this, cm); // Functions can be used to supply values for autocomplete widget
if (token.type == "string") {
prefix = token.string;
var n = 0;
if (/['"]/.test(token.string.charAt(0))) {
quote = token.string.charAt(0);
prefix = token.string.slice(1);
n++;
}
var len = token.string.length;
if (/['"]/.test(token.string.charAt(len - 1))) {
quote = token.string.charAt(len - 1);
prefix = token.string.substr(n, len - 2);
}
replaceToken = true;
}
Expand Down
4 changes: 3 additions & 1 deletion addon/selection/active-line.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@
function updateActiveLines(cm, ranges) {
var active = [];
for (var i = 0; i < ranges.length; i++) {
var line = cm.getLineHandleVisualStart(ranges[i].head.line);
var range = ranges[i];
if (!range.empty()) continue;
var line = cm.getLineHandleVisualStart(range.head.line);
if (active[active.length - 1] != line) active.push(line);
}
if (sameArray(cm.state.activeLines, active)) return;
Expand Down
5 changes: 3 additions & 2 deletions addon/tern/tern.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
cm.showHint({hint: this.getHint});
},

showType: function(cm, pos) { showType(this, cm, pos); },
showType: function(cm, pos, c) { showType(this, cm, pos, c); },

updateArgHints: function(cm) { updateArgHints(this, cm); },

Expand Down Expand Up @@ -239,7 +239,7 @@

// Type queries

function showType(ts, cm, pos) {
function showType(ts, cm, pos, c) {
ts.request(cm, "type", function(error, data) {
if (error) return showError(ts, cm, error);
if (ts.options.typeTip) {
Expand All @@ -254,6 +254,7 @@
}
}
tempTooltip(cm, tip);
if (c) c();
}, pos);
}

Expand Down
6 changes: 4 additions & 2 deletions bin/release
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ rewrite("lib/codemirror.js", function(lib) {
return lib.replace(/CodeMirror\.version = "\d+\.\d+\.\d+"/,
"CodeMirror.version = \"" + number + "\"");
});
rewrite("package.json", function(pack) {
function rewriteJSON(pack) {
return pack.replace(/"version":"\d+\.\d+\.\d+"/, "\"version\":\"" + number + "\"");
});
}
rewrite("package.json", rewriteJSON);
rewrite("bower.json", rewriteJSON);
rewrite("doc/manual.html", function(manual) {
return manual.replace(/>version \d+\.\d+\.\d+<\/span>/, ">version " + number + "</span>");
});
Expand Down
1 change: 1 addition & 0 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "CodeMirror",
"version":"4.3.0",
"main": ["lib/codemirror.js", "lib/codemirror.css"],
"ignore": [
"**/.*",
Expand Down
2 changes: 1 addition & 1 deletion demo/lint.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<script src="../lib/codemirror.js"></script>
<script src="../mode/javascript/javascript.js"></script>
<script src="../mode/css/css.js"></script>
<script src="http://ajax.aspnetcdn.com/ajax/jshint/r07/jshint.js"></script>
<script src="//ajax.aspnetcdn.com/ajax/jshint/r07/jshint.js"></script>
<script src="https://rawgithub.com/zaach/jsonlint/79b553fb65c192add9066da64043458981b3972b/lib/jsonlint.js"></script>
<script src="https://rawgithub.com/stubbornella/csslint/master/release/csslint.js"></script>
<script src="../addon/lint/lint.js"></script>
Expand Down
6 changes: 3 additions & 3 deletions demo/markselection.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!doctype html>

<title>CodeMirror: Match Selection Demo</title>
<title>CodeMirror: Selection Marking Demo</title>
<meta charset="utf-8"/>
<link rel=stylesheet href="../doc/docs.css">

Expand All @@ -22,12 +22,12 @@
<li><a href="https://github.com/marijnh/codemirror">Code</a>
</ul>
<ul>
<li><a class=active href="#">Match Selection</a>
<li><a class=active href="#">Selection Marking</a>
</ul>
</div>

<article>
<h2>Match Selection Demo</h2>
<h2>Selection Marking Demo</h2>
<form><textarea id="code" name="code">Select something from here.
You'll see that the selection's foreground color changes to white!
Since, by default, CodeMirror only puts an independent "marker" layer
Expand Down
1 change: 0 additions & 1 deletion demo/matchtags.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
<script src="../mode/xml/xml.js"></script>
<style type="text/css">
.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
.CodeMirror-matchingtag { background: rgba(255, 150, 0, .3); }
</style>
<div id=nav>
<a href="http://codemirror.net"><img id=logo src="../doc/logo.png"></a>
Expand Down
2 changes: 1 addition & 1 deletion demo/widget.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<link rel="stylesheet" href="../lib/codemirror.css">
<script src="../lib/codemirror.js"></script>
<script src="../mode/javascript/javascript.js"></script>
<script src="http://ajax.aspnetcdn.com/ajax/jshint/r07/jshint.js"></script>
<script src="//ajax.aspnetcdn.com/ajax/jshint/r07/jshint.js"></script>
<style type="text/css">
.CodeMirror {border: 1px solid black;}
.lint-error {font-family: arial; font-size: 70%; background: #ffa; color: #a00; padding: 2px 5px 3px; }
Expand Down
2 changes: 2 additions & 0 deletions doc/compress.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ <h2>Script compression helper</h2>
<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=4.3.0;f=">4.3</option>
<option value="http://marijnhaverbeke.nl/git/codemirror?a=blob_plain;hb=4.2.1;f=">4.2</option>
<option value="http://marijnhaverbeke.nl/git/codemirror?a=blob_plain;hb=4.2.0;f=">4.2</option>
<option value="http://marijnhaverbeke.nl/git/codemirror?a=blob_plain;hb=4.1.0;f=">4.1</option>
<option value="http://marijnhaverbeke.nl/git/codemirror?a=blob_plain;hb=4.0.3;f=">4.0</option>
Expand Down
2 changes: 1 addition & 1 deletion doc/docs.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
font-family: 'Source Sans Pro';
font-style: normal;
font-weight: 400;
src: local('Source Sans Pro'), local('SourceSansPro-Regular'), url(http://themes.googleusercontent.com/static/fonts/sourcesanspro/v5/ODelI1aHBYDBqgeIAH2zlBM0YzuT7MdOe03otPbuUS0.woff) format('woff');
src: local('Source Sans Pro'), local('SourceSansPro-Regular'), url(//themes.googleusercontent.com/static/fonts/sourcesanspro/v5/ODelI1aHBYDBqgeIAH2zlBM0YzuT7MdOe03otPbuUS0.woff) format('woff');
}

body, html { margin: 0; padding: 0; height: 100%; }
Expand Down
11 changes: 6 additions & 5 deletions doc/manual.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
<section class=first id=overview>
<h2 style="position: relative">
User manual and reference guide
<span style="color: #888; font-size: 1rem; position: absolute; right: 0; bottom: 0">version 4.2.0</span>
<span style="color: #888; font-size: 1rem; position: absolute; right: 0; bottom: 0">version 4.3.0</span>
</h2>

<p>CodeMirror is a code-editor component that can be embedded in
Expand Down Expand Up @@ -370,7 +370,8 @@ <h2>Configuration</h2>

<dt id="option_cursorBlinkRate"><code><strong>cursorBlinkRate</strong>: number</code></dt>
<dd>Half-period in milliseconds used for cursor blinking. The default blink
rate is 530ms. By setting this to zero, blinking can be disabled.</dd>
rate is 530ms. By setting this to zero, blinking can be disabled. A
negative value hides the cursor entirely.</dd>

<dt id="option_cursorScrollMargin"><code><strong>cursorScrollMargin</strong>: number</code></dt>
<dd>How much extra space to always keep above and below the
Expand Down Expand Up @@ -1199,7 +1200,7 @@ <h3 id="api_selection">Cursor and selection methods</h3>
merged). Each object in the array contains <code>anchor</code>
and <code>head</code> properties referring to <code>{line,
ch}</code> objects.</dd>

<dt id="somethingSelected"><code><strong>doc.somethingSelected</strong>() → boolean</code></dt>
<dd>Return true if any text is selected.</dd>
<dt id="setCursor"><code><strong>doc.setCursor</strong>(pos: {line, ch}|number, ?ch: number, ?options: object)</code></dt>
Expand Down Expand Up @@ -1598,7 +1599,7 @@ <h3 id="api_decoration">Widget, gutter, and decoration methods</h3>
<dd>Remove all gutter markers in
the <a href="#option_gutters">gutter</a> with the given ID.</dd>

<dt id="addLineClass"><code><strong>cm.addLineClass</strong>(line: integer|LineHandle, where: string, class: string) → LineHandle</code></dt>
<dt id="addLineClass"><code><strong>doc.addLineClass</strong>(line: integer|LineHandle, where: string, class: string) → LineHandle</code></dt>
<dd>Set a CSS class name for the given line. <code>line</code>
can be a number or a line handle. <code>where</code> determines
to which element this class should be applied, can can be one
Expand All @@ -1609,7 +1610,7 @@ <h3 id="api_decoration">Widget, gutter, and decoration methods</h3>
gutter elements). <code>class</code> should be the name of the
class to apply.</dd>

<dt id="removeLineClass"><code><strong>cm.removeLineClass</strong>(line: integer|LineHandle, where: string, class: string) → LineHandle</code></dt>
<dt id="removeLineClass"><code><strong>doc.removeLineClass</strong>(line: integer|LineHandle, where: string, class: string) → LineHandle</code></dt>
<dd>Remove a CSS class from a line. <code>line</code> can be a
line handle or number. <code>where</code> should be one
of <code>"text"</code>, <code>"background"</code>,
Expand Down
11 changes: 8 additions & 3 deletions doc/realworld.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@

<h2>CodeMirror real-world uses</h2>

<p><a href="mailto:marijnh@gmail.com">Contact me</a> if you'd like
your project to be added to this list.</p>
<p>Create a <a href="https://github.com/marijnh/codemirror">pull
request</a> or <a href="mailto:marijnh@gmail.com">email me</a> if
you'd like your project to be added to this list.</p>

<ul>
<li><a href="http://brackets.io">Adobe Brackets</a> (code editor)</li>
Expand All @@ -46,6 +47,7 @@ <h2>CodeMirror real-world uses</h2>
<li><a href="http://code.google.com/p/codemirror2-gwt/">CodeMirror2-GWT</a> (Google Web Toolkit wrapper)</li>
<li><a href="http://www.crunchzilla.com/code-monster">Code Monster</a> & <a href="http://www.crunchzilla.com/code-maven">Code Maven</a> (learning environment)</li>
<li><a href="http://codepen.io">Codepen</a> (gallery of animations)</li>
<li><a href="https://coderpad.io/">Coderpad</a> (interviewing tool)</li>
<li><a href="http://sasstwo.codeschool.com/levels/1/challenges/1">Code School</a> (online tech learning environment)</li>
<li><a href="http://code-snippets.bungeshea.com/">Code Snippets</a> (WordPress snippet management plugin)</li>
<li><a href="http://antonmi.github.io/code_together/">Code together</a> (collaborative editing)</li>
Expand All @@ -65,14 +67,16 @@ <h2>CodeMirror real-world uses</h2>
<li><a href="http://elm-lang.org/Examples.elm">Elm language examples</a></li>
<li><a href="http://eloquentjavascript.net/chapter1.html">Eloquent JavaScript</a> (book)</li>
<li><a href="http://emmet.io">Emmet</a> (fast XML editing)</li>
<li><a href="https://github.com/espruino/EspruinoWebIDE">Espruino Web IDE</a> (Chrome App for writing code on Espruino devices)</li>
<li><a href="http://www.fastfig.com/">Fastfig</a> (online computation/math tool)</li>
<li><a href="https://metacpan.org/module/Farabi">Farabi</a> (modern Perl IDE)</li>
<li><a href="http://blog.pamelafox.org/2012/02/interactive-html5-slides-with-fathomjs.html">FathomJS integration</a> (slides with editors, again)</li>
<li><a href="http://fiddlesalad.com/">Fiddle Salad</a> (web development environment)</li>
<li><a href="https://github.com/simogeo/Filemanager">Filemanager</a></li>
<li><a href="https://hacks.mozilla.org/2013/11/firefox-developer-tools-episode-27-edit-as-html-codemirror-more/">Firefox Developer Tools</a></li>
<li><a href="http://www.firepad.io">Firepad</a> (collaborative text editor)</li>
<li><a href="https://code.google.com/p/gerrit/">Gerrit</a>'s diff view</a></li>
<li><a href="https://code.google.com/p/gerrit/">Gerrit</a>'s diff view</li>
<li><a href="https://github.com/maks/git-crx">Git Crx</a> (Chrome App for browsing local git repos)</li>
<li><a href="http://tour.golang.org">Go language tour</a></li>
<li><a href="https://github.com/github/android">GitHub's Android app</a></li>
<li><a href="https://script.google.com/">Google Apps Script</a></li>
Expand Down Expand Up @@ -119,6 +123,7 @@ <h2>CodeMirror real-world uses</h2>
<li><a href="http://www.quivive-file-manager.com">Quivive File Manager</a></li>
<li><a href="http://rascalmicro.com/docs/basic-tutorial-getting-started.html">Rascal</a> (tiny computer)</li>
<li><a href="https://www.realtime.io/">RealTime.io</a> (Internet-of-Things infrastructure)</li>
<li><a href="https://chrome.google.com/webstore/detail/servephp/mnpikomdchjhkhbhmbboehfdjkobbfpo">ServePHP</a> (PHP code testing in Chrome dev tools)</li>
<li><a href="https://www.shadertoy.com/">Shadertoy</a> (shader sharing)</li>
<li><a href="http://www.sketchpatch.net/labs/livecodelabIntro.html">sketchPatch Livecodelab</a></li>
<li><a href="http://www.skulpt.org/">Skulpt</a> (in-browser Python environment)</li>
Expand Down
13 changes: 13 additions & 0 deletions doc/releases.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,19 @@ <h2>Release notes and version history</h2>

<h2 id="v4">Version 4.x</h2>

<p class="rel">23-06-2014: <a href="http://codemirror.net/codemirror-4.3.zip">Version 4.3</a>:</p>

<ul class="rel-note">
<li>Several <a href="../demo/vim.html">vim bindings</a>
improvements: search and exCommand history, global flag
for <code>:substitute</code>, <code>:global</code> command.
<li>Allow hiding the cursor by
setting <a href="manual.html#option_cursorBlinkRate"><code>cursorBlinkRate</code></a>
to a negative value.</li>
<li>Make gutter markers themeable, use this in foldgutter.</li>
<li>Full <a href="https://github.com/marijnh/CodeMirror/compare/4.2.0...4.3.0">list of patches</a>.</li>
</ul>

<p class="rel">19-05-2014: <a href="http://codemirror.net/codemirror-4.2.zip">Version 4.2</a>:</p>

<ul class="rel-note">
Expand Down
2 changes: 1 addition & 1 deletion doc/reporting.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ <h2>Reporting bugs effectively</h2>
<li>If the problem can not be reproduced in any of the demos
included in the CodeMirror distribution, please provide an HTML
document that demonstrates the problem. The best way to do this is
to go to <a href="http://jsbin.com/ihunin/edit">jsbin.com</a>, enter
to go to <a href="http://jsbin.com/ihunin/1/edit">jsbin.com</a>, enter
it there, press save, and include the resulting link in your bug
report.</li>
</ol>
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ <h2>This is CodeMirror</h2>
</script>
<div style="position: relative; margin: 1em 0;">
<a class="bigbutton left" href="http://codemirror.net/codemirror.zip">DOWNLOAD LATEST RELEASE</a>
<div><strong>version 4.2</strong> (<a href="doc/releases.html">Release notes</a>)</div>
<div><strong>version 4.3</strong> (<a href="doc/releases.html">Release notes</a>)</div>
<div>or use the <a href="doc/compress.html">minification helper</a></div>
<div style="position: absolute; top: 0; right: 0; text-align: right">
<span class="bigbutton right" onclick="document.getElementById('paypal').submit();">DONATE WITH PAYPAL</span>
Expand Down
Loading