Showing with 3,147 additions and 1,088 deletions.
  1. +17 −0 AUTHORS
  2. +1 −1 addon/dialog/dialog.js
  3. +94 −0 addon/display/panel.js
  4. +4 −4 addon/edit/continuelist.js
  5. +1 −2 addon/hint/anyword-hint.js
  6. +1 −1 addon/hint/css-hint.js
  7. +1 −1 addon/hint/html-hint.js
  8. +8 −3 addon/hint/javascript-hint.js
  9. +0 −102 addon/hint/python-hint.js
  10. +1 −1 addon/hint/show-hint.js
  11. +7 −4 addon/hint/sql-hint.js
  12. +3 −4 addon/hint/xml-hint.js
  13. +14 −0 addon/merge/merge.css
  14. +170 −63 addon/merge/merge.js
  15. +11 −8 addon/mode/simple.js
  16. +76 −0 addon/scroll/annotatescrollbar.js
  17. +66 −0 addon/scroll/simplescrollbars.css
  18. +139 −0 addon/scroll/simplescrollbars.js
  19. +8 −0 addon/search/matchesonscrollbar.css
  20. +90 −0 addon/search/matchesonscrollbar.js
  21. +9 −4 addon/search/search.js
  22. +5 −3 addon/tern/tern.js
  23. +1 −1 bower.json
  24. +18 −10 demo/merge.html
  25. +64 −0 demo/panel.html
  26. +2 −9 demo/resize.html
  27. +7 −1 demo/search.html
  28. +82 −0 demo/simplescrollbars.html
  29. +3 −1 demo/tern.html
  30. +4 −0 demo/theme.html
  31. +8 −2 doc/compress.html
  32. +105 −24 doc/manual.html
  33. +4 −0 doc/realworld.html
  34. +23 −0 doc/releases.html
  35. +5 −4 index.html
  36. +25 −7 keymap/emacs.js
  37. +181 −109 keymap/vim.js
  38. +2 −11 lib/codemirror.css
  39. +289 −184 lib/codemirror.js
  40. +2 −2 mode/coffeescript/coffeescript.js
  41. +5 −3 mode/commonlisp/commonlisp.js
  42. +6 −1 mode/css/index.html
  43. +1 −1 mode/cypher/cypher.js
  44. +50 −0 mode/dart/dart.js
  45. +71 −0 mode/dart/index.html
  46. +5 −9 mode/dockerfile/dockerfile.js
  47. +2 −1 mode/dockerfile/index.html
  48. +195 −0 mode/ebnf/ebnf.js
  49. +102 −0 mode/ebnf/index.html
  50. +8 −4 mode/index.html
  51. +2 −0 mode/javascript/javascript.js
  52. +6 −0 mode/javascript/test.js
  53. +3 −3 mode/markdown/markdown.js
  54. +6 −1 mode/meta.js
  55. +2 −2 mode/puppet/puppet.js
  56. +2 −1 mode/shell/shell.js
  57. +68 −0 mode/soy/index.html
  58. +198 −0 mode/soy/soy.js
  59. +42 −0 mode/spreadsheet/index.html
  60. +109 −0 mode/spreadsheet/spreadsheet.js
  61. +4 −6 mode/stex/stex.js
  62. +15 −4 mode/textile/test.js
  63. +392 −476 mode/textile/textile.js
  64. +3 −1 mode/turtle/turtle.js
  65. +1 −1 package.json
  66. +3 −0 test/emacs_test.js
  67. +1 −0 test/index.html
  68. +105 −0 test/scroll_test.js
  69. +34 −8 test/test.js
  70. +83 −0 test/vim_test.js
  71. +35 −0 theme/tomorrow-night-bright.css
  72. +37 −0 theme/zenburn.css
17 changes: 17 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ Curtis Gagliardi
dagsta
daines
Dale Jung
Dan Bentley
Dan Heberden
Daniel, Dao Quang Minh
Daniele Di Sarli
Expand All @@ -98,12 +99,15 @@ Daniel KJ
Daniel Neel
Daniel Parnell
Danny Yoo
darealshinji
Darius Roberts
Dave Myers
David Mignot
David Pathakjee
David Vázquez
deebugger
Deep Thought
Devon Carew
dignifiedquire
Dimage Sapelkin
domagoj412
Expand Down Expand Up @@ -135,11 +139,13 @@ ForbesLindesay
Forbes Lindesay
Ford_Lawnmower
Frank Wiegand
Gabriel Gheorghian
Gabriel Horner
Gabriel Nahmias
galambalazs
Gautam Mehta
gekkoe
Gerard Braad
Gergely Hegykozi
Glenn Jorde
Glenn Ruehle
Expand Down Expand Up @@ -172,6 +178,7 @@ Ivan Kurnosov
Jacob Lee
Jakob Miland
Jakub Vrana
Jakub Vrána
James Campos
James Thorne
Jamie Hill
Expand All @@ -182,6 +189,7 @@ Jan Odvarko
Jan T. Sott
Jared Forsyth
Jason
Jason Barnabe
Jason Grout
Jason Johnston
Jason San Jose
Expand Down Expand Up @@ -217,13 +225,15 @@ kaniga
Ken Newman
Ken Rockot
Kevin Sawicki
Kevin Ushey
Klaus Silveira
Koh Zi Han, Cliff
komakino
Konstantin Lopuhin
koops
ks-ifware
kubelsmieci
Lanfei
Lanny
Laszlo Vidacs
leaf corcoran
Expand Down Expand Up @@ -285,6 +295,7 @@ MinRK
Miraculix87
misfo
mloginov
Moritz Schwörer
mps
mtaran-google
Narciso Jaramillo
Expand All @@ -311,6 +322,7 @@ Page
Panupong Pasupat
paris
Patil Arpith
Patrick Stoica
Patrick Strawderman
Paul Garvin
Paul Ivanov
Expand All @@ -325,11 +337,13 @@ prasanthj
Prasanth J
Radek Piórkowski
Rahul
Randall Mason
Randy Burden
Randy Edmunds
Rasmus Erik Voel Jensen
Richard van der Meer
Richard Z.H. Wang
Robert Crossfield
Roberto Abdelkader Martínez Pérez
robertop23
Robert Plummer
Expand All @@ -354,6 +368,7 @@ sheopory
Shiv Deepak
Shmuel Englard
Shubham Jain
silverwind
snasa
soliton4
sonson
Expand Down Expand Up @@ -393,11 +408,13 @@ Vincent Woo
Volker Mische
wenli
Wesley Wiser
Will Binns-Smith
William Jamieson
William Stein
Willy
Wojtek Ptak
Xavier Mendez
Yassin N. Hassan
YNH Webdev
Yunchi Luo
Yuvi Panda
Expand Down
2 changes: 1 addition & 1 deletion addon/dialog/dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
CodeMirror.e_stop(e);
close();
}
if (e.keyCode == 13) callback(inp.value);
if (e.keyCode == 13) callback(inp.value, e);
});

if (options.closeOnBlur !== false) CodeMirror.on(inp, "blur", close);
Expand Down
94 changes: 94 additions & 0 deletions addon/display/panel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE

(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../../lib/codemirror"));
else if (typeof define == "function" && define.amd) // AMD
define(["../../lib/codemirror"], mod);
else // Plain browser env
mod(CodeMirror);
})(function(CodeMirror) {
CodeMirror.defineExtension("addPanel", function(node, 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 height = (options && options.height) || node.offsetHeight;
this._setSize(null, info.heightLeft -= height);
info.panels++;
return new Panel(this, node, options, height);
});

function Panel(cm, node, options, height) {
this.cm = cm;
this.node = node;
this.options = options;
this.height = height;
this.cleared = false;
}

Panel.prototype.clear = function() {
if (this.cleared) return;
this.cleared = true;
var info = this.cm.state.panels;
this.cm._setSize(null, info.heightLeft += this.height);
info.wrapper.removeChild(this.node);
if (--info.panels == 0) removePanels(this.cm);
};

Panel.prototype.changed = function(height) {
var newHeight = height == null ? this.node.offsetHeight : height;
var info = this.cm.state.panels;
this.cm._setSize(null, info.height += (newHeight - this.height));
this.height = newHeight;
};

function initPanels(cm) {
var wrap = cm.getWrapperElement();
var style = window.getComputedStyle ? window.getComputedStyle(wrap) : wrap.currentStyle;
var height = parseInt(style.height);
var info = cm.state.panels = {
setHeight: wrap.style.height,
heightLeft: height,
panels: 0,
wrapper: document.createElement("div")
};
wrap.parentNode.insertBefore(info.wrapper, wrap);
var hasFocus = cm.hasFocus();
info.wrapper.appendChild(wrap);
if (hasFocus) cm.focus();

cm._setSize = cm.setSize;
if (height != null) cm.setSize = function(width, newHeight) {
if (newHeight == null) return this._setSize(width, newHeight);
info.setHeight = newHeight;
if (typeof newHeight != "number") {
var px = /^(\d+\.?\d*)px$/.exec(newHeight);
if (px) {
newHeight = Number(px[1]);
} else {
info.wrapper.style.height = newHeight;
newHeight = info.wrapper.offsetHeight;
info.wrapper.style.height = "";
}
}
cm._setSize(width, info.heightLeft += (newHeight - height));
height = newHeight;
};
}

function removePanels(cm) {
var info = cm.state.panels;
cm.state.panels = null;

var wrap = cm.getWrapperElement();
info.wrapper.parentNode.replaceChild(wrap, info.wrapper);
wrap.style.height = info.setHeight;
cm.setSize = cm._setSize;
cm.setSize();
}
});
8 changes: 4 additions & 4 deletions addon/edit/continuelist.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
})(function(CodeMirror) {
"use strict";

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

CodeMirror.commands.newlineAndIndentContinueMarkdownList = function(cm) {
if (cm.getOption("disableInput")) return CodeMirror.Pass;
Expand All @@ -38,7 +38,7 @@

} else {
var indent = match[1], after = match[4];
var bullet = unorderedBullets.indexOf(match[2]) >= 0 || match[2].indexOf(">") >= 0
var bullet = unorderedListRE.test(match[2]) || match[2].indexOf(">") >= 0
? match[2]
: (parseInt(match[3], 10) + 1) + ".";

Expand Down
3 changes: 1 addition & 2 deletions addon/hint/anyword-hint.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
var word = options && options.word || WORD;
var range = options && options.range || RANGE;
var cur = editor.getCursor(), curLine = editor.getLine(cur.line);
var start = cur.ch, end = start;
while (end < curLine.length && word.test(curLine.charAt(end))) ++end;
var end = cur.ch, start = end;
while (start && word.test(curLine.charAt(start - 1))) --start;
var curWord = start != end && curLine.slice(start, end);

Expand Down
2 changes: 1 addition & 1 deletion addon/hint/css-hint.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
var inner = CodeMirror.innerMode(cm.getMode(), token.state);
if (inner.mode.name != "css") return;

var word = token.string, start = token.start, end = token.end;
var start = token.start, end = cur.ch, word = token.string.slice(0, end - start);
if (/[^\w$_-]/.test(word)) {
word = ""; start = end = cur.ch;
}
Expand Down
2 changes: 1 addition & 1 deletion addon/hint/html-hint.js
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../../lib/codemirror", "./xml-hint"));
mod(require("../../lib/codemirror"), require("./xml-hint"));
else if (typeof define == "function" && define.amd) // AMD
define(["../../lib/codemirror", "./xml-hint"], mod);
else // Plain browser env
Expand Down
11 changes: 8 additions & 3 deletions addon/hint/javascript-hint.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,20 @@

function scriptHint(editor, keywords, getToken, options) {
// Find the token at the cursor
var cur = editor.getCursor(), token = getToken(editor, cur), tprop = token;
var cur = editor.getCursor(), token = getToken(editor, cur);
if (/\b(?:string|comment)\b/.test(token.type)) return;
token.state = CodeMirror.innerMode(editor.getMode(), token.state).state;

// If it's not a 'word-style' token, ignore the token.
if (!/^[\w$_]*$/.test(token.string)) {
token = tprop = {start: cur.ch, end: cur.ch, string: "", state: token.state,
type: token.string == "." ? "property" : null};
token = {start: cur.ch, end: cur.ch, string: "", state: token.state,
type: token.string == "." ? "property" : null};
} else if (token.end > cur.ch) {
token.end = cur.ch;
token.string = token.string.slice(0, cur.ch - token.start);
}

var tprop = token;
// If it is a property, find out what it is a property of.
while (tprop.type == "property") {
tprop = getToken(editor, Pos(cur.line, tprop.start));
Expand Down
Loading