Showing with 1,620 additions and 334 deletions.
  1. +15 −0 AUTHORS
  2. +22 −4 addon/display/panel.js
  3. +5 −5 addon/edit/continuelist.js
  4. +63 −65 addon/hint/show-hint.js
  5. +1 −1 addon/lint/javascript-lint.js
  6. +14 −9 addon/mode/multiplex.js
  7. +19 −4 addon/scroll/annotatescrollbar.js
  8. +3 −1 addon/search/matchesonscrollbar.js
  9. +7 −4 addon/search/search.js
  10. +2 −2 addon/search/searchcursor.js
  11. +4 −2 bower.json
  12. +97 −25 demo/panel.html
  13. +3 −3 demo/tern.html
  14. +2 −0 demo/theme.html
  15. +3 −0 doc/compress.html
  16. +53 −25 doc/manual.html
  17. +2 −0 doc/realworld.html
  18. +17 −2 doc/releases.html
  19. +2 −2 index.html
  20. +1 −1 keymap/sublime.js
  21. +117 −23 keymap/vim.js
  22. +2 −0 lib/codemirror.css
  23. +92 −39 lib/codemirror.js
  24. +1 −1 mode/clike/clike.js
  25. +3 −1 mode/css/css.js
  26. +3 −0 mode/css/less_test.js
  27. +1 −1 mode/css/scss_test.js
  28. +307 −24 mode/django/django.js
  29. +27 −17 mode/django/index.html
  30. +53 −0 mode/handlebars/handlebars.js
  31. +83 −0 mode/handlebars/index.html
  32. +2 −0 mode/index.html
  33. +5 −1 mode/javascript/javascript.js
  34. +15 −13 mode/markdown/markdown.js
  35. +1 −1 mode/markdown/test.js
  36. +1 −0 mode/meta.js
  37. +85 −0 mode/mumps/index.html
  38. +148 −0 mode/mumps/mumps.js
  39. +2 −4 mode/python/python.js
  40. +17 −6 mode/smarty/smarty.js
  41. +3 −3 mode/soy/soy.js
  42. +4 −4 mode/sql/sql.js
  43. +8 −3 mode/stylus/stylus.js
  44. +8 −7 mode/z80/index.html
  45. +34 −18 mode/z80/z80.js
  46. +1 −1 package.json
  47. +10 −2 test/test.js
  48. +155 −8 test/vim_test.js
  49. +95 −0 theme/liquibyte.css
  50. +1 −1 theme/monokai.css
  51. +1 −1 theme/solarized.css
15 changes: 15 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Alexandre Bique
alexey-k
Alex Piggott
Aliaksei Chapyzhenka
Amin Shali
Amsul
amuntean
Amy
Expand Down Expand Up @@ -81,10 +82,13 @@ Cheah Chu Yeow
Chris Coyier
Chris Granger
Chris Houseknecht
Chris Lohfink
Chris Morgan
Christian Oyarzun
Christian Petrov
Christopher Brown
Christopher Mitchell
Christopher Pfohl
ciaranj
CodeAnimal
coderaiser
Expand All @@ -106,6 +110,7 @@ Danny Yoo
darealshinji
Darius Roberts
Dave Myers
David Barnett
David Mignot
David Pathakjee
David Vázquez
Expand Down Expand Up @@ -182,6 +187,7 @@ ilvalle
Ingo Richter
Irakli Gozalishvili
Ivan Kurnosov
Ivoah
Jacob Lee
Jakob Miland
Jakub Vrana
Expand Down Expand Up @@ -213,6 +219,7 @@ John Connor
John Lees-Miller
John Snelson
John Van Der Loo
Jonas Döbertin
Jonathan Malmaud
jongalloway
Jon Malmaud
Expand All @@ -223,6 +230,7 @@ Joshua Newman
Josh Watzman
jots
jsoojeon
ju1ius
Juan Benavides Romero
Jucovschi Constantin
Juho Vuori
Expand Down Expand Up @@ -250,6 +258,8 @@ Leonid Khachaturov
Leon Sorokin
Leonya Khachaturov
Liam Newman
Libo Cannici
LloydMilligan
LM
lochel
Lorenzo Stoakes
Expand All @@ -274,6 +284,7 @@ Marko Bonaci
Martin Balek
Martín Gaitán
Martin Hasoň
Martin Hunt
Mason Malone
Mateusz Paprocki
Mathias Bynens
Expand All @@ -292,6 +303,7 @@ Max Xiantu
mbarkhau
Metatheos
Micah Dubinko
Michael Grey
Michael Lehenbauer
Michael Zhou
Mighty Guava
Expand All @@ -308,6 +320,7 @@ misfo
mloginov
Moritz Schwörer
mps
ms
mtaran-google
Narciso Jaramillo
Nathan Williams
Expand All @@ -319,6 +332,7 @@ nguillaumin
Ng Zhi An
Nicholas Bollweg
Nicholas Bollweg (Nick)
Nick Kreeger
Nick Small
Niels van Groningen
nightwing
Expand All @@ -333,6 +347,7 @@ pablo
Page
Panupong Pasupat
paris
Paris
Patil Arpith
Patrick Stoica
Patrick Strawderman
Expand Down
26 changes: 22 additions & 4 deletions addon/display/panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,31 @@
mod(CodeMirror);
})(function(CodeMirror) {
CodeMirror.defineExtension("addPanel", function(node, options) {
options = options || {};

if (!this.state.panels) initPanels(this);

var info = this.state.panels;
if (options && options.position == "bottom")
info.wrapper.appendChild(node);
else
info.wrapper.insertBefore(node, info.wrapper.firstChild);
var wrapper = info.wrapper;
var cmWrapper = this.getWrapperElement();

if (options.after instanceof Panel && !options.after.cleared) {
wrapper.insertBefore(node, options.before.node.nextSibling);
} else if (options.before instanceof Panel && !options.before.cleared) {
wrapper.insertBefore(node, options.before.node);
} else if (options.replace instanceof Panel && !options.replace.cleared) {
wrapper.insertBefore(node, options.replace.node);
options.replace.clear();
} else if (options.position == "bottom") {
wrapper.appendChild(node);
} else if (options.position == "before-bottom") {
wrapper.insertBefore(node, cmWrapper.nextSibling);
} else if (options.position == "after-top") {
wrapper.insertBefore(node, cmWrapper);
} else {
wrapper.insertBefore(node, wrapper.firstChild);
}

var height = (options && options.height) || node.offsetHeight;
this._setSize(null, info.heightLeft -= height);
info.panels++;
Expand Down
10 changes: 5 additions & 5 deletions addon/edit/continuelist.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,23 @@
if (cm.getOption("disableInput")) return CodeMirror.Pass;
var ranges = cm.listSelections(), replacements = [];
for (var i = 0; i < ranges.length; i++) {
var pos = ranges[i].head, match;
var pos = ranges[i].head;
var eolState = cm.getStateAfter(pos.line);
var inList = eolState.list !== false;
var inQuote = eolState.quote !== false;
var inQuote = eolState.quote !== 0;

if (!ranges[i].empty() || (!inList && !inQuote) || !(match = cm.getLine(pos.line).match(listRE))) {
var line = cm.getLine(pos.line), match = listRE.exec(line);
if (!ranges[i].empty() || (!inList && !inQuote) || !match) {
cm.execCommand("newlineAndIndent");
return;
}
if (cm.getLine(pos.line).match(emptyListRE)) {
if (emptyListRE.test(line)) {
cm.replaceRange("", {
line: pos.line, ch: 0
}, {
line: pos.line, ch: pos.ch + 1
});
replacements[i] = "\n";

} else {
var indent = match[1], after = match[4];
var bullet = unorderedListRE.test(match[2]) || match[2].indexOf(">") >= 0
Expand Down
128 changes: 63 additions & 65 deletions addon/hint/show-hint.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,44 +24,44 @@
return cm.showHint(newOpts);
};

var asyncRunID = 0;
function retrieveHints(getter, cm, options, then) {
if (getter.async) {
var id = ++asyncRunID;
getter(cm, function(hints) {
if (asyncRunID == id) then(hints);
}, options);
} else {
then(getter(cm, options));
}
}

CodeMirror.defineExtension("showHint", function(options) {
// We want a single cursor position.
if (this.listSelections().length > 1 || this.somethingSelected()) return;

if (this.state.completionActive) this.state.completionActive.close();
var completion = this.state.completionActive = new Completion(this, options);
var getHints = completion.options.hint;
if (!getHints) return;
if (!completion.options.hint) return;

CodeMirror.signal(this, "startCompletion", this);
return retrieveHints(getHints, this, completion.options, function(hints) { completion.showHints(hints); });
completion.update();
});

function Completion(cm, options) {
this.cm = cm;
this.options = this.buildOptions(options);
this.widget = this.onClose = null;
this.widget = null;
this.debounce = 0;
this.tick = 0;
this.startPos = this.cm.getCursor();
this.startLen = this.cm.getLine(this.startPos.line).length;

var self = this;
cm.on("cursorActivity", this.activityFunc = function() { self.cursorActivity(); });
}

var requestAnimationFrame = window.requestAnimationFrame || function(fn) {
return setTimeout(fn, 1000/60);
};
var cancelAnimationFrame = window.cancelAnimationFrame || clearTimeout;

Completion.prototype = {
close: function() {
if (!this.active()) return;
this.cm.state.completionActive = null;
this.tick = null;
this.cm.off("cursorActivity", this.activityFunc);

if (this.widget) this.widget.close();
if (this.onClose) this.onClose();
CodeMirror.signal(this.cm, "endCompletion", this.cm);
},

Expand All @@ -87,61 +87,51 @@
this.showWidget(data);
},

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

var debounce = 0, completion = this, finished;
var closeOn = this.options.closeCharacters;
var startPos = this.cm.getCursor(), startLen = this.cm.getLine(startPos.line).length;

var requestAnimationFrame = window.requestAnimationFrame || function(fn) {
return setTimeout(fn, 1000/60);
};
var cancelAnimationFrame = window.cancelAnimationFrame || clearTimeout;

function done() {
if (finished) return;
finished = true;
completion.close();
completion.cm.off("cursorActivity", activity);
if (data) CodeMirror.signal(data, "close");
cursorActivity: function() {
if (this.debounce) {
cancelAnimationFrame(this.debounce);
this.debounce = 0;
}

function update() {
if (finished) return;
CodeMirror.signal(data, "update");
retrieveHints(completion.options.hint, completion.cm, completion.options, finishUpdate);
}
function finishUpdate(data_) {
data = data_;
if (finished) return;
if (!data || !data.list.length) return done();
if (completion.widget) completion.widget.close();
completion.widget = new Widget(completion, data);
var pos = this.cm.getCursor(), line = this.cm.getLine(pos.line);
if (pos.line != this.startPos.line || line.length - pos.ch != this.startLen - this.startPos.ch ||
pos.ch < this.startPos.ch || this.cm.somethingSelected() ||
(pos.ch && this.options.closeCharacters.test(line.charAt(pos.ch - 1)))) {
this.close();
} else {
var self = this;
this.debounce = requestAnimationFrame(function() {self.update();});
if (this.widget) this.widget.disable();
}
},

function clearDebounce() {
if (debounce) {
cancelAnimationFrame(debounce);
debounce = 0;
}
update: function() {
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);
} else {
var myTick = ++this.tick, self = this;
this.options.hint(this.cm, function(data) {
if (self.tick == myTick) self.finishUpdate(data);
}, this.options);
}
},

function activity() {
clearDebounce();
var pos = completion.cm.getCursor(), line = completion.cm.getLine(pos.line);
if (pos.line != startPos.line || line.length - pos.ch != startLen - startPos.ch ||
pos.ch < startPos.ch || completion.cm.somethingSelected() ||
(pos.ch && closeOn.test(line.charAt(pos.ch - 1)))) {
completion.close();
} else {
debounce = requestAnimationFrame(update);
if (completion.widget) completion.widget.close();
}
finishUpdate: function(data) {
this.data = data;
var picked = this.widget && this.widget.picked;
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);
}
this.cm.on("cursorActivity", activity);
this.onClose = done;
},

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

buildOptions: function(options) {
Expand Down Expand Up @@ -206,6 +196,7 @@
function Widget(completion, data) {
this.completion = completion;
this.data = data;
this.picked = false;
var widget = this, cm = completion.cm;

var hints = this.hints = document.createElement("ul");
Expand Down Expand Up @@ -320,6 +311,13 @@
cm.off("scroll", this.onScroll);
},

disable: function() {
this.completion.cm.removeKeyMap(this.keyMap);
var widget = this;
this.keyMap = {Enter: function() { widget.picked = true; }};
this.completion.cm.addKeyMap(this.keyMap);
},

pick: function() {
this.completion.pick(this.data, this.selectedHint);
},
Expand Down
2 changes: 1 addition & 1 deletion addon/lint/javascript-lint.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

function validator(text, options) {
if (!window.JSHINT) return [];
JSHINT(text, options);
JSHINT(text, options, options.globals);
var errors = JSHINT.data().errors, result = [];
if (errors) parseErrors(errors, result);
return result;
Expand Down
Loading