Showing with 1,914 additions and 385 deletions.
  1. +7 −0 AUTHORS
  2. +1 −1 LICENSE
  3. +2 −2 addon/dialog/dialog.css
  4. +1 −2 addon/display/rulers.js
  5. +1 −0 addon/edit/closebrackets.js
  6. +14 −23 addon/hint/show-hint.js
  7. +12 −3 addon/hint/sql-hint.js
  8. +6 −6 addon/lint/lint.js
  9. +1 −1 addon/search/search.js
  10. +2 −2 addon/search/searchcursor.js
  11. +1 −1 addon/tern/worker.js
  12. +1 −1 bower.json
  13. +2 −0 demo/theme.html
  14. +13 −8 demo/vim.html
  15. +6 −0 doc/compress.html
  16. +132 −1 doc/manual.html
  17. +11 −1 doc/releases.html
  18. +1 −1 index.html
  19. +64 −67 keymap/vim.js
  20. +34 −27 lib/codemirror.js
  21. +1 −2 mode/apl/apl.js
  22. +204 −0 mode/asn.1/asn.1.js
  23. +78 −0 mode/asn.1/index.html
  24. +2 −4 mode/asterisk/asterisk.js
  25. +98 −36 mode/clike/clike.js
  26. +27 −0 mode/clike/test.js
  27. +1 −16 mode/css/css.js
  28. +0 −7 mode/css/test.js
  29. +1 −1 mode/cypher/cypher.js
  30. +18 −26 mode/dylan/dylan.js
  31. +1 −2 mode/ecl/ecl.js
  32. +0 −2 mode/eiffel/eiffel.js
  33. +2 −2 mode/htmlmixed/htmlmixed.js
  34. +5 −0 mode/index.html
  35. +0 −2 mode/julia/julia.js
  36. +2 −2 mode/livescript/livescript.js
  37. +72 −0 mode/mathematica/index.html
  38. +175 −0 mode/mathematica/mathematica.js
  39. +1 −0 mode/meta.js
  40. +1 −0 mode/php/php.js
  41. +15 −25 mode/pig/pig.js
  42. +2 −2 mode/sql/sql.js
  43. +36 −47 mode/tiddlywiki/tiddlywiki.js
  44. +8 −19 mode/tiki/tiki.js
  45. +115 −0 mode/ttcn-cfg/index.html
  46. +214 −0 mode/ttcn-cfg/ttcn-cfg.js
  47. +118 −0 mode/ttcn/index.html
  48. +283 −0 mode/ttcn/ttcn.js
  49. +30 −40 mode/xquery/xquery.js
  50. +2 −3 package.json
  51. +1 −0 test/index.html
  52. +9 −0 test/sql-hint-test.js
  53. +13 −0 test/vim_test.js
  54. +1 −0 theme/monokai.css
  55. +66 −0 theme/ttcn.css
7 changes: 7 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ Ankit Ahuja
Ansel Santosa
Anthony Grimes
Anton Kovalyov
AQNOUCH Mohammed
areos
as3boyan
AtomicPages LLC
Expand All @@ -76,6 +77,7 @@ Brett Zamir
Brian Grinstead
Brian Sletten
Bruce Mitchener
Calin Barbat
Chandra Sekhar Pydi
Charles Skelton
Cheah Chu Yeow
Expand Down Expand Up @@ -173,6 +175,7 @@ Hakan Tunc
Hans Engel
Hardest
Hasan Karahan
Hector Oswaldo Caballero
Herculano Campos
Hiroyuki Makino
hitsthings
Expand Down Expand Up @@ -266,6 +269,7 @@ Lorenzo Stoakes
Luciano Longo
Luke Stagner
lynschinzer
Madhura Jayaratne
Maksim Lin
Maksym Taran
Malay Majithia
Expand All @@ -290,6 +294,7 @@ Mateusz Paprocki
Mathias Bynens
mats cronqvist
Matthew Beale
Matthew Rathbone
Matthias Bussonnier
Matthias BUSSONNIER
Matt McDonald
Expand All @@ -306,6 +311,7 @@ Micah Dubinko
Michael Grey
Michael Lehenbauer
Michael Zhou
Michal Dorner
Mighty Guava
Miguel Castillo
mihailik
Expand Down Expand Up @@ -342,6 +348,7 @@ Nikolay Kostov
nilp0inter
Nisarg Jhaveri
nlwillia
noragrossman
Norman Rzepka
pablo
Page
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (C) 2014 by Marijn Haverbeke <marijnh@gmail.com> and others
Copyright (C) 2015 by Marijn Haverbeke <marijnh@gmail.com> and others

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
4 changes: 2 additions & 2 deletions addon/dialog/dialog.css
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
.CodeMirror-dialog {
position: absolute;
left: 0; right: 0;
background: white;
background: inherit;
z-index: 15;
padding: .1em .8em;
overflow: hidden;
color: #333;
color: inherit;
}

.CodeMirror-dialog-top {
Expand Down
3 changes: 1 addition & 2 deletions addon/display/rulers.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
for (var i = 0; i < val.length; i++) {
var elt = document.createElement("div");
elt.className = "CodeMirror-ruler";
var col, cls = null, conf = val[i];
var col, conf = val[i];
if (typeof conf == "number") {
col = conf;
} else {
Expand All @@ -47,7 +47,6 @@
if (conf.color) elt.style.borderColor = conf.color;
if (conf.lineStyle) elt.style.borderLeftStyle = conf.lineStyle;
if (conf.width) elt.style.borderLeftWidth = conf.width;
cls = val[i].className;
}
elt.style.left = (left + col * cw) + "px";
elt.style.top = "-50px";
Expand Down
1 change: 1 addition & 0 deletions addon/edit/closebrackets.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@
cm.replaceSelections(sels, "around");
} else if (type == "both") {
cm.replaceSelection(left + right, null);
cm.triggerElectric(left + right);
cm.execCommand("goCharLeft");
} else if (type == "addFour") {
cm.replaceSelection(left + left + left + left, "before");
Expand Down
37 changes: 14 additions & 23 deletions addon/hint/show-hint.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
if (!completion.options.hint) return;

CodeMirror.signal(this, "startCompletion", this);
completion.update();
completion.update(true);
});

function Completion(cm, options) {
Expand Down Expand Up @@ -61,6 +61,7 @@
this.tick = null;
this.cm.off("cursorActivity", this.activityFunc);

if (this.widget && this.data) CodeMirror.signal(this.data, "close");
if (this.widget) this.widget.close();
CodeMirror.signal(this.cm, "endCompletion", this.cm);
},
Expand All @@ -78,15 +79,6 @@
this.close();
},

showHints: function(data) {
if (!data || !data.list.length || !this.active()) return this.close();

if (this.options.completeSingle && data.list.length == 1)
this.pick(data, 0);
else
this.showWidget(data);
},

cursorActivity: function() {
if (this.debounce) {
cancelAnimationFrame(this.debounce);
Expand All @@ -105,35 +97,34 @@
}
},

update: function() {
update: function(first) {
if (this.tick == null) return;
if (this.data) CodeMirror.signal(this.data, "update");
if (!this.options.hint.async) {
this.finishUpdate(this.options.hint(this.cm, this.options), myTick);
this.finishUpdate(this.options.hint(this.cm, this.options), first);
} else {
var myTick = ++this.tick, self = this;
this.options.hint(this.cm, function(data) {
if (self.tick == myTick) self.finishUpdate(data);
if (self.tick == myTick) self.finishUpdate(data, first);
}, this.options);
}
},

finishUpdate: function(data) {
finishUpdate: function(data, first) {
this.data = data;
var picked = this.widget && this.widget.picked;

var picked = (this.widget && this.widget.picked) || (first && this.options.completeSingle);
if (this.widget) this.widget.close();
if (data && data.list.length) {
if (picked && data.list.length == 1) this.pick(data, 0);
else this.widget = new Widget(this, data);
if (picked && data.list.length == 1) {
this.pick(data, 0);
} else {
this.widget = new Widget(this, data);
CodeMirror.signal(data, "shown");
}
}
},

showWidget: function(data) {
this.data = data;
this.widget = new Widget(this, data);
CodeMirror.signal(data, "shown");
},

buildOptions: function(options) {
var editor = this.cm.options.hintOptions;
var out = {};
Expand Down
15 changes: 12 additions & 3 deletions addon/hint/sql-hint.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,14 @@
string = nameParts.pop();
var table = nameParts.join(".");

var alias = false;
var aliasTable = table;
// Check if table is available. If not, find table by Alias
if (!getItem(tables, table))
if (!getItem(tables, table)) {
var oldTable = table;
table = findTableByAlias(table, editor);
if (table !== oldTable) alias = true;
}

var columns = getItem(tables, table);
if (columns && columns.columns)
Expand All @@ -123,7 +128,9 @@
if (columns) {
addMatches(result, string, columns, function(w) {
if (typeof w == "string") {
w = table + "." + w;
var tableInsert = table;
if (alias == true) tableInsert = aliasTable;
w = tableInsert + "." + w;
} else {
w = shallowClone(w);
w.text = table + "." + w.text;
Expand Down Expand Up @@ -205,6 +212,7 @@
CodeMirror.registerHelper("hint", "sql", function(editor, options) {
tables = (options && options.tables) || {};
var defaultTableName = options && options.defaultTable;
var disableKeywords = options && options.disableKeywords;
defaultTable = defaultTableName && getItem(tables, defaultTableName);
keywords = keywords || getKeywords(editor);

Expand Down Expand Up @@ -237,7 +245,8 @@
} else {
addMatches(result, search, tables, function(w) {return w;});
addMatches(result, search, defaultTable, function(w) {return w;});
addMatches(result, search, keywords, function(w) {return w.toUpperCase();});
if (!disableKeywords)
addMatches(result, search, keywords, function(w) {return w.toUpperCase();});
}

return {list: result, from: Pos(cur.line, start), to: Pos(cur.line, end)};
Expand Down
12 changes: 6 additions & 6 deletions addon/lint/lint.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,9 @@
this.onMouseOver = function(e) { onMouseOver(cm, e); };
}

function parseOptions(cm, options) {
function parseOptions(_cm, options) {
if (options instanceof Function) return {getAnnotations: options};
if (!options || options === true) options = {};
if (!options.getAnnotations) options.getAnnotations = cm.getHelper(CodeMirror.Pos(0, 0), "lint");
if (!options.getAnnotations) throw new Error("Required option 'getAnnotations' missing (lint addon)");
return options;
}

Expand Down Expand Up @@ -120,10 +118,12 @@
function startLinting(cm) {
var state = cm.state.lint, options = state.options;
var passOptions = options.options || options; // Support deprecated passing of `options` property in options
if (options.async || options.getAnnotations.async)
options.getAnnotations(cm.getValue(), updateLinting, passOptions, cm);
var getAnnotations = options.getAnnotations || cm.getHelper(CodeMirror.Pos(0, 0), "lint");
if (!getAnnotations) return;
if (options.async || getAnnotations.async)
getAnnotations(cm.getValue(), updateLinting, passOptions, cm);
else
updateLinting(cm, options.getAnnotations(cm.getValue(), passOptions, cm));
updateLinting(cm, getAnnotations(cm.getValue(), passOptions, cm));
}

function updateLinting(cm, annotationsNotSorted) {
Expand Down
2 changes: 1 addition & 1 deletion addon/search/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
var doReplaceConfirm = "Replace? <button>Yes</button> <button>No</button> <button>Stop</button>";
function replace(cm, all) {
if (cm.getOption("readOnly")) return;
var query = cm.getSelection() || getSearchState().lastQuery;
var query = cm.getSelection() || getSearchState(cm).lastQuery;
dialog(cm, replaceQueryDialog, "Replace:", query, function(query) {
if (!query) return;
query = parseQuery(query);
Expand Down
4 changes: 2 additions & 2 deletions addon/search/searchcursor.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,9 @@
});

CodeMirror.defineExtension("selectMatches", function(query, caseFold) {
var ranges = [], next;
var ranges = [];
var cur = this.getSearchCursor(query, this.getCursor("from"), caseFold);
while (next = cur.findNext()) {
while (cur.findNext()) {
if (CodeMirror.cmpPos(cur.to(), this.getCursor("to")) > 0) break;
ranges.push({anchor: cur.from(), head: cur.to()});
}
Expand Down
2 changes: 1 addition & 1 deletion addon/tern/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ function startServer(defs, plugins, scripts) {
});
}

var console = {
this.console = {
log: function(v) { postMessage({type: "debug", message: v}); }
};
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "codemirror",
"version":"5.2.0",
"version":"5.3.0",
"main": ["lib/codemirror.js", "lib/codemirror.css"],
"ignore": [
"**/.*",
Expand Down
2 changes: 2 additions & 0 deletions demo/theme.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
<link rel="stylesheet" href="../theme/the-matrix.css">
<link rel="stylesheet" href="../theme/tomorrow-night-bright.css">
<link rel="stylesheet" href="../theme/tomorrow-night-eighties.css">
<link rel="stylesheet" href="../theme/ttcn.css">
<link rel="stylesheet" href="../theme/twilight.css">
<link rel="stylesheet" href="../theme/vibrant-ink.css">
<link rel="stylesheet" href="../theme/xq-dark.css">
Expand Down Expand Up @@ -105,6 +106,7 @@ <h2>Theme Demo</h2>
<option>the-matrix</option>
<option>tomorrow-night-bright</option>
<option>tomorrow-night-eighties</option>
<option>ttcn</option>
<option>twilight</option>
<option>vibrant-ink</option>
<option>xq-dark</option>
Expand Down
21 changes: 13 additions & 8 deletions demo/vim.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

<link rel="stylesheet" href="../lib/codemirror.css">
<link rel="stylesheet" href="../addon/dialog/dialog.css">
<link rel="stylesheet" href="../theme/midnight.css">
<link rel="stylesheet" href="../theme/solarized.css">
<script src="../lib/codemirror.js"></script>
<script src="../addon/dialog/dialog.js"></script>
<script src="../addon/search/searchcursor.js"></script>
Expand Down Expand Up @@ -47,17 +49,16 @@ <h2>Vim bindings demo</h2>
</textarea></form>
<div style="font-size: 13px; width: 300px; height: 30px;">Key buffer: <span id="command-display"></span></div>

<p>The vim keybindings are enabled by
including <a href="../keymap/vim.js">keymap/vim.js</a> and setting
the <code>vimMode</code> option to <code>true</code>. This will also
automatically change the <code>keyMap</code> option to <code>"vim"</code>.</p>
<p>The vim keybindings are enabled by including <code><a
href="../keymap/vim.js">keymap/vim.js</a></code> and setting the
<code>keyMap</code> option to <code>vim</code>.</p>

<p><strong>Features</strong></p>

<ul>
<li>All common motions and operators, including text objects</li>
<li>Operator motion orthogonality</li>
<li>Visual mode - characterwise, linewise, partial support for blockwise</li>
<li>Visual mode - characterwise, linewise, blockwise</li>
<li>Full macro support (q, @)</li>
<li>Incremental highlighted search (/, ?, #, *, g#, g*)</li>
<li>Search/replace with confirm (:substitute, :%s)</li>
Expand All @@ -71,9 +72,13 @@ <h2>Vim bindings demo</h2>
<li>Cross-buffer yank/paste</li>
</ul>

<p>Note that while the vim mode tries to emulate the most useful features of
vim as faithfully as possible, it does not strive to become a complete vim
implementation</p>
<p>For the full list of key mappings and Ex commands, refer to the
<code>defaultKeymap</code> and <code>defaultExCommandMap</code> at the
top of <code><a href="../keymap/vim.js">keymap/vim.js</a></code>.

<p>Note that while the vim mode tries to emulate the most useful
features of vim as faithfully as possible, it does not strive to
become a complete vim implementation</p>

<script>
CodeMirror.commands.save = function(){ alert("Saving"); };
Expand Down
6 changes: 6 additions & 0 deletions doc/compress.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ <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=5.3.0;f=">5.3</option>
<option value="http://marijnhaverbeke.nl/git/codemirror?a=blob_plain;hb=5.2.0;f=">5.2</option>
<option value="http://marijnhaverbeke.nl/git/codemirror?a=blob_plain;hb=5.1.0;f=">5.1</option>
<option value="http://marijnhaverbeke.nl/git/codemirror?a=blob_plain;hb=5.0.0;f=">5.0</option>
Expand Down Expand Up @@ -105,6 +106,8 @@ <h2>Script compression helper</h2>
</optgroup>
<optgroup label="Modes">
<option value="http://codemirror.net/mode/apl/apl.js">apl.js</option>
<option value="http://codemirror.net/mode/asn.1/asn.1.js">asn.1.js</option>
<option value="http://codemirror.net/mode/asterisk/asterisk.js">asterisk.js</option>
<option value="http://codemirror.net/mode/asciiarmor/asciiarmor.js">asciiarmor.js</option>
<option value="http://codemirror.net/mode/clike/clike.js">clike.js</option>
<option value="http://codemirror.net/mode/clojure/clojure.js">clojure.js</option>
Expand Down Expand Up @@ -148,6 +151,7 @@ <h2>Script compression helper</h2>
<option value="http://codemirror.net/mode/livescript/livescript.js">livescript.js</option>
<option value="http://codemirror.net/mode/lua/lua.js">lua.js</option>
<option value="http://codemirror.net/mode/markdown/markdown.js">markdown.js</option>
<option value="http://codemirror.net/mode/mathematica/mathematica.js">mathematica.js</option>
<option value="http://codemirror.net/mode/mirc/mirc.js">mirc.js</option>
<option value="http://codemirror.net/mode/mllike/mllike.js">mllike.js</option>
<option value="http://codemirror.net/mode/modelica/modelica.js">modelica.js</option>
Expand Down Expand Up @@ -191,6 +195,8 @@ <h2>Script compression helper</h2>
<option value="http://codemirror.net/mode/toml/toml.js">toml.js</option>
<option value="http://codemirror.net/mode/tornado/tornado.js">tornado.js</option>
<option value="http://codemirror.net/mode/troff/troff.js">troff.js</option>
<option value="http://codemirror.net/mode/ttcn/ttcn.js">ttcn.js</option>
<option value="http://codemirror.net/mode/ttcn-cfg/ttcn-cfg.js">ttcn-cfg.js</option>
<option value="http://codemirror.net/mode/turtle/turtle.js">turtle.js</option>
<option value="http://codemirror.net/mode/vb/vb.js">vb.js</option>
<option value="http://codemirror.net/mode/vbscript/vbscript.js">vbscript.js</option>
Expand Down
Loading