codemirror-rails 3.24 → 4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/codemirror/rails/version.rb +2 -2
- data/vendor/assets/javascripts/codemirror.js +3001 -1798
- data/vendor/assets/javascripts/codemirror/addons/comment/comment.js +24 -4
- data/vendor/assets/javascripts/codemirror/addons/comment/continuecomment.js +47 -32
- data/vendor/assets/javascripts/codemirror/addons/dialog/dialog.js +9 -2
- data/vendor/assets/javascripts/codemirror/addons/display/fullscreen.js +9 -2
- data/vendor/assets/javascripts/codemirror/addons/display/placeholder.js +9 -2
- data/vendor/assets/javascripts/codemirror/addons/display/rulers.js +9 -2
- data/vendor/assets/javascripts/codemirror/addons/edit/closebrackets.js +76 -37
- data/vendor/assets/javascripts/codemirror/addons/edit/closetag.js +59 -37
- data/vendor/assets/javascripts/codemirror/addons/edit/continuelist.js +25 -17
- data/vendor/assets/javascripts/codemirror/addons/edit/matchbrackets.js +67 -46
- data/vendor/assets/javascripts/codemirror/addons/edit/matchtags.js +10 -3
- data/vendor/assets/javascripts/codemirror/addons/edit/trailingspace.js +23 -14
- data/vendor/assets/javascripts/codemirror/addons/fold/brace-fold.js +12 -3
- data/vendor/assets/javascripts/codemirror/addons/fold/comment-fold.js +12 -0
- data/vendor/assets/javascripts/codemirror/addons/fold/foldcode.js +28 -3
- data/vendor/assets/javascripts/codemirror/addons/fold/foldgutter.js +9 -2
- data/vendor/assets/javascripts/codemirror/addons/fold/indent-fold.js +12 -1
- data/vendor/assets/javascripts/codemirror/addons/fold/markdown-fold.js +12 -0
- data/vendor/assets/javascripts/codemirror/addons/fold/xml-fold.js +9 -4
- data/vendor/assets/javascripts/codemirror/addons/hint/anyword-hint.js +9 -2
- data/vendor/assets/javascripts/codemirror/addons/hint/css-hint.js +10 -3
- data/vendor/assets/javascripts/codemirror/addons/hint/html-hint.js +11 -3
- data/vendor/assets/javascripts/codemirror/addons/hint/javascript-hint.js +9 -4
- data/vendor/assets/javascripts/codemirror/addons/hint/python-hint.js +11 -3
- data/vendor/assets/javascripts/codemirror/addons/hint/show-hint.js +10 -4
- data/vendor/assets/javascripts/codemirror/addons/hint/sql-hint.js +9 -2
- data/vendor/assets/javascripts/codemirror/addons/hint/xml-hint.js +22 -34
- data/vendor/assets/javascripts/codemirror/addons/lint/coffeescript-lint.js +12 -1
- data/vendor/assets/javascripts/codemirror/addons/lint/css-lint.js +12 -1
- data/vendor/assets/javascripts/codemirror/addons/lint/javascript-lint.js +9 -4
- data/vendor/assets/javascripts/codemirror/addons/lint/json-lint.js +12 -1
- data/vendor/assets/javascripts/codemirror/addons/lint/lint.js +12 -8
- data/vendor/assets/javascripts/codemirror/addons/lint/yaml-lint.js +12 -1
- data/vendor/assets/javascripts/codemirror/addons/merge/merge.js +18 -16
- data/vendor/assets/javascripts/codemirror/addons/mode/loadmode.js +9 -2
- data/vendor/assets/javascripts/codemirror/addons/mode/multiplex.js +12 -0
- data/vendor/assets/javascripts/codemirror/addons/mode/overlay.js +15 -10
- data/vendor/assets/javascripts/codemirror/addons/runmode/colorize.js +11 -3
- data/vendor/assets/javascripts/codemirror/addons/runmode/runmode-standalone.js +0 -2
- data/vendor/assets/javascripts/codemirror/addons/runmode/runmode.js +12 -0
- data/vendor/assets/javascripts/codemirror/addons/runmode/runmode.node.js +4 -0
- data/vendor/assets/javascripts/codemirror/addons/scroll/scrollpastend.js +9 -2
- data/vendor/assets/javascripts/codemirror/addons/search/match-highlighter.js +12 -3
- data/vendor/assets/javascripts/codemirror/addons/search/search.js +24 -16
- data/vendor/assets/javascripts/codemirror/addons/search/searchcursor.js +21 -2
- data/vendor/assets/javascripts/codemirror/addons/selection/active-line.js +38 -17
- data/vendor/assets/javascripts/codemirror/addons/selection/mark-selection.js +16 -9
- data/vendor/assets/javascripts/codemirror/addons/tern/tern.js +33 -5
- data/vendor/assets/javascripts/codemirror/addons/wrap/hardwrap.js +27 -2
- data/vendor/assets/javascripts/codemirror/keymaps/emacs.js +12 -5
- data/vendor/assets/javascripts/codemirror/keymaps/sublime.js +505 -0
- data/vendor/assets/javascripts/codemirror/keymaps/vim.js +138 -179
- data/vendor/assets/javascripts/codemirror/modes/apl.js +12 -0
- data/vendor/assets/javascripts/codemirror/modes/asterisk.js +12 -0
- data/vendor/assets/javascripts/codemirror/modes/clike.js +15 -4
- data/vendor/assets/javascripts/codemirror/modes/clojure.js +13 -0
- data/vendor/assets/javascripts/codemirror/modes/cobol.js +12 -0
- data/vendor/assets/javascripts/codemirror/modes/coffeescript.js +12 -0
- data/vendor/assets/javascripts/codemirror/modes/commonlisp.js +12 -0
- data/vendor/assets/javascripts/codemirror/modes/css.js +18 -27
- data/vendor/assets/javascripts/codemirror/modes/d.js +12 -2
- data/vendor/assets/javascripts/codemirror/modes/diff.js +12 -0
- data/vendor/assets/javascripts/codemirror/modes/dtd.js +12 -0
- data/vendor/assets/javascripts/codemirror/modes/ecl.js +12 -0
- data/vendor/assets/javascripts/codemirror/modes/eiffel.js +12 -0
- data/vendor/assets/javascripts/codemirror/modes/erlang.js +13 -1
- data/vendor/assets/javascripts/codemirror/modes/fortran.js +12 -0
- data/vendor/assets/javascripts/codemirror/modes/gas.js +12 -0
- data/vendor/assets/javascripts/codemirror/modes/gfm.js +12 -0
- data/vendor/assets/javascripts/codemirror/modes/gherkin.js +12 -0
- data/vendor/assets/javascripts/codemirror/modes/go.js +12 -1
- data/vendor/assets/javascripts/codemirror/modes/groovy.js +12 -0
- data/vendor/assets/javascripts/codemirror/modes/haml.js +12 -0
- data/vendor/assets/javascripts/codemirror/modes/haskell.js +12 -0
- data/vendor/assets/javascripts/codemirror/modes/haxe.js +18 -9
- data/vendor/assets/javascripts/codemirror/modes/htmlembedded.js +12 -0
- data/vendor/assets/javascripts/codemirror/modes/htmlmixed.js +12 -0
- data/vendor/assets/javascripts/codemirror/modes/http.js +12 -0
- data/vendor/assets/javascripts/codemirror/modes/jade.js +12 -0
- data/vendor/assets/javascripts/codemirror/modes/javascript.js +23 -16
- data/vendor/assets/javascripts/codemirror/modes/jinja2.js +53 -118
- data/vendor/assets/javascripts/codemirror/modes/julia.js +12 -0
- data/vendor/assets/javascripts/codemirror/modes/livescript.js +17 -4
- data/vendor/assets/javascripts/codemirror/modes/lua.js +12 -0
- data/vendor/assets/javascripts/codemirror/modes/markdown.js +12 -0
- data/vendor/assets/javascripts/codemirror/modes/mirc.js +13 -0
- data/vendor/assets/javascripts/codemirror/modes/mllike.js +12 -1
- data/vendor/assets/javascripts/codemirror/modes/nginx.js +12 -0
- data/vendor/assets/javascripts/codemirror/modes/ntriples.js +13 -0
- data/vendor/assets/javascripts/codemirror/modes/octave.js +12 -0
- data/vendor/assets/javascripts/codemirror/modes/pascal.js +12 -0
- data/vendor/assets/javascripts/codemirror/modes/pegjs.js +12 -0
- data/vendor/assets/javascripts/codemirror/modes/perl.js +84 -73
- data/vendor/assets/javascripts/codemirror/modes/php.js +20 -101
- data/vendor/assets/javascripts/codemirror/modes/pig.js +12 -0
- data/vendor/assets/javascripts/codemirror/modes/properties.js +12 -0
- data/vendor/assets/javascripts/codemirror/modes/puppet.js +13 -0
- data/vendor/assets/javascripts/codemirror/modes/python.js +21 -11
- data/vendor/assets/javascripts/codemirror/modes/q.js +12 -0
- data/vendor/assets/javascripts/codemirror/modes/r.js +13 -3
- data/vendor/assets/javascripts/codemirror/modes/{rpm-spec.js → rpm.js} +34 -2
- data/vendor/assets/javascripts/codemirror/modes/rst.js +12 -0
- data/vendor/assets/javascripts/codemirror/modes/ruby.js +11 -0
- data/vendor/assets/javascripts/codemirror/modes/rust.js +12 -0
- data/vendor/assets/javascripts/codemirror/modes/sass.js +12 -0
- data/vendor/assets/javascripts/codemirror/modes/scheme.js +13 -0
- data/vendor/assets/javascripts/codemirror/modes/shell.js +12 -0
- data/vendor/assets/javascripts/codemirror/modes/sieve.js +11 -4
- data/vendor/assets/javascripts/codemirror/modes/smalltalk.js +12 -0
- data/vendor/assets/javascripts/codemirror/modes/smarty.js +13 -0
- data/vendor/assets/javascripts/codemirror/modes/smartymixed.js +14 -2
- data/vendor/assets/javascripts/codemirror/modes/solr.js +12 -0
- data/vendor/assets/javascripts/codemirror/modes/sparql.js +12 -0
- data/vendor/assets/javascripts/codemirror/modes/sql.js +12 -0
- data/vendor/assets/javascripts/codemirror/modes/stex.js +12 -0
- data/vendor/assets/javascripts/codemirror/modes/tcl.js +13 -0
- data/vendor/assets/javascripts/codemirror/modes/tiddlywiki.js +13 -0
- data/vendor/assets/javascripts/codemirror/modes/tiki.js +12 -0
- data/vendor/assets/javascripts/codemirror/modes/toml.js +12 -0
- data/vendor/assets/javascripts/codemirror/modes/turtle.js +12 -0
- data/vendor/assets/javascripts/codemirror/modes/vb.js +12 -0
- data/vendor/assets/javascripts/codemirror/modes/vbscript.js +13 -0
- data/vendor/assets/javascripts/codemirror/modes/velocity.js +12 -0
- data/vendor/assets/javascripts/codemirror/modes/verilog.js +89 -236
- data/vendor/assets/javascripts/codemirror/modes/xml.js +41 -60
- data/vendor/assets/javascripts/codemirror/modes/xquery.js +12 -0
- data/vendor/assets/javascripts/codemirror/modes/yaml.js +12 -0
- data/vendor/assets/javascripts/codemirror/modes/z80.js +12 -0
- data/vendor/assets/stylesheets/codemirror.css +15 -10
- data/vendor/assets/stylesheets/codemirror/themes/ambiance.css +1 -0
- data/vendor/assets/stylesheets/codemirror/themes/lesser-dark.css +4 -0
- data/vendor/assets/stylesheets/codemirror/themes/mdn-like.css +1 -1
- data/vendor/assets/stylesheets/codemirror/themes/pastel-on-dark.css +1 -0
- data/vendor/assets/stylesheets/codemirror/themes/rubyblue.css +2 -0
- data/vendor/assets/stylesheets/codemirror/themes/solarized.css +17 -3
- metadata +20 -25
- data/vendor/assets/javascripts/codemirror/keymaps/extra.js +0 -43
- data/vendor/assets/javascripts/codemirror/modes/django.js +0 -55
- data/vendor/assets/javascripts/codemirror/modes/dylan.js +0 -284
- data/vendor/assets/javascripts/codemirror/modes/less.js +0 -347
- data/vendor/assets/javascripts/codemirror/modes/rpm-changes.js +0 -19
- data/vendor/assets/stylesheets/codemirror/modes/rpm-spec.css +0 -5
@@ -1,4 +1,11 @@
|
|
1
|
-
(function() {
|
1
|
+
(function(mod) {
|
2
|
+
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
3
|
+
mod(require("../../lib/codemirror"));
|
4
|
+
else if (typeof define == "function" && define.amd) // AMD
|
5
|
+
define(["../../lib/codemirror"], mod);
|
6
|
+
else // Plain browser env
|
7
|
+
mod(CodeMirror);
|
8
|
+
})(function(CodeMirror) {
|
2
9
|
"use strict";
|
3
10
|
// declare global: diff_match_patch, DIFF_INSERT, DIFF_DELETE, DIFF_EQUAL
|
4
11
|
|
@@ -46,14 +53,6 @@
|
|
46
53
|
}
|
47
54
|
};
|
48
55
|
|
49
|
-
function ensureDiff(dv) {
|
50
|
-
if (dv.diffOutOfDate) {
|
51
|
-
dv.diff = getDiff(dv.orig.getValue(), dv.edit.getValue());
|
52
|
-
dv.diffOutOfDate = false;
|
53
|
-
CodeMirror.signal(dv.edit, "updateDiff", dv.diff);
|
54
|
-
}
|
55
|
-
}
|
56
|
-
|
57
56
|
function registerUpdate(dv) {
|
58
57
|
var edit = {from: 0, to: 0, marked: []};
|
59
58
|
var orig = {from: 0, to: 0, marked: []};
|
@@ -66,7 +65,11 @@
|
|
66
65
|
clearMarks(dv.orig, orig.marked, dv.classes);
|
67
66
|
edit.from = edit.to = orig.from = orig.to = 0;
|
68
67
|
}
|
69
|
-
|
68
|
+
if (dv.diffOutOfDate) {
|
69
|
+
dv.diff = getDiff(dv.orig.getValue(), dv.edit.getValue());
|
70
|
+
dv.diffOutOfDate = false;
|
71
|
+
CodeMirror.signal(dv.edit, "updateDiff", dv.diff);
|
72
|
+
}
|
70
73
|
if (dv.showDifferences) {
|
71
74
|
updateMarks(dv.edit, dv.diff, edit, DIFF_INSERT, dv.classes);
|
72
75
|
updateMarks(dv.orig, dv.diff, orig, DIFF_DELETE, dv.classes);
|
@@ -359,10 +362,10 @@
|
|
359
362
|
if (this.left) this.left.setShowDifferences(val);
|
360
363
|
},
|
361
364
|
rightChunks: function() {
|
362
|
-
return this.right && getChunks(this.right);
|
365
|
+
return this.right && getChunks(this.right.diff);
|
363
366
|
},
|
364
367
|
leftChunks: function() {
|
365
|
-
return this.left && getChunks(this.left);
|
368
|
+
return this.left && getChunks(this.left.diff);
|
366
369
|
}
|
367
370
|
};
|
368
371
|
|
@@ -413,10 +416,9 @@
|
|
413
416
|
f(startOrig, orig.line + 1, startEdit, edit.line + 1);
|
414
417
|
}
|
415
418
|
|
416
|
-
function getChunks(
|
417
|
-
ensureDiff(dv);
|
419
|
+
function getChunks(diff) {
|
418
420
|
var collect = [];
|
419
|
-
iterateChunks(
|
421
|
+
iterateChunks(diff, function(topOrig, botOrig, topEdit, botEdit) {
|
420
422
|
collect.push({origFrom: topOrig, origTo: botOrig,
|
421
423
|
editFrom: topEdit, editTo: botEdit});
|
422
424
|
});
|
@@ -500,4 +502,4 @@
|
|
500
502
|
function posMin(a, b) { return (a.line - b.line || a.ch - b.ch) < 0 ? a : b; }
|
501
503
|
function posMax(a, b) { return (a.line - b.line || a.ch - b.ch) > 0 ? a : b; }
|
502
504
|
function posEq(a, b) { return a.line == b.line && a.ch == b.ch; }
|
503
|
-
})
|
505
|
+
});
|
@@ -1,4 +1,11 @@
|
|
1
|
-
(function() {
|
1
|
+
(function(mod) {
|
2
|
+
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
3
|
+
mod(require("../../lib/codemirror"));
|
4
|
+
else if (typeof define == "function" && define.amd) // AMD
|
5
|
+
define(["../../lib/codemirror"], mod);
|
6
|
+
else // Plain browser env
|
7
|
+
mod(CodeMirror);
|
8
|
+
})(function(CodeMirror) {
|
2
9
|
if (!CodeMirror.modeURL) CodeMirror.modeURL = "../mode/%N/%N.js";
|
3
10
|
|
4
11
|
var loading = {};
|
@@ -48,4 +55,4 @@
|
|
48
55
|
instance.setOption("mode", instance.getOption("mode"));
|
49
56
|
});
|
50
57
|
};
|
51
|
-
}
|
58
|
+
});
|
@@ -1,3 +1,13 @@
|
|
1
|
+
(function(mod) {
|
2
|
+
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
3
|
+
mod(require("../../lib/codemirror"));
|
4
|
+
else if (typeof define == "function" && define.amd) // AMD
|
5
|
+
define(["../../lib/codemirror"], mod);
|
6
|
+
else // Plain browser env
|
7
|
+
mod(CodeMirror);
|
8
|
+
})(function(CodeMirror) {
|
9
|
+
"use strict";
|
10
|
+
|
1
11
|
CodeMirror.multiplexingMode = function(outer /*, others */) {
|
2
12
|
// Others should be {open, close, mode [, delimStyle] [, innerStyle]} objects
|
3
13
|
var others = Array.prototype.slice.call(arguments, 1);
|
@@ -101,3 +111,5 @@ CodeMirror.multiplexingMode = function(outer /*, others */) {
|
|
101
111
|
}
|
102
112
|
};
|
103
113
|
};
|
114
|
+
|
115
|
+
});
|
@@ -6,16 +6,24 @@
|
|
6
6
|
// overlay wins, unless the combine argument was true, in which case
|
7
7
|
// the styles are combined.
|
8
8
|
|
9
|
-
|
10
|
-
|
9
|
+
(function(mod) {
|
10
|
+
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
11
|
+
mod(require("../../lib/codemirror"));
|
12
|
+
else if (typeof define == "function" && define.amd) // AMD
|
13
|
+
define(["../../lib/codemirror"], mod);
|
14
|
+
else // Plain browser env
|
15
|
+
mod(CodeMirror);
|
16
|
+
})(function(CodeMirror) {
|
17
|
+
"use strict";
|
18
|
+
|
19
|
+
CodeMirror.overlayMode = function(base, overlay, combine) {
|
11
20
|
return {
|
12
21
|
startState: function() {
|
13
22
|
return {
|
14
23
|
base: CodeMirror.startState(base),
|
15
24
|
overlay: CodeMirror.startState(overlay),
|
16
25
|
basePos: 0, baseCur: null,
|
17
|
-
overlayPos: 0, overlayCur: null
|
18
|
-
lineSeen: null
|
26
|
+
overlayPos: 0, overlayCur: null
|
19
27
|
};
|
20
28
|
},
|
21
29
|
copyState: function(state) {
|
@@ -28,12 +36,6 @@ CodeMirror.overlayMode = CodeMirror.overlayParser = function(base, overlay, comb
|
|
28
36
|
},
|
29
37
|
|
30
38
|
token: function(stream, state) {
|
31
|
-
if (stream.sol() || stream.string != state.lineSeen ||
|
32
|
-
Math.min(state.basePos, state.overlayPos) < stream.start) {
|
33
|
-
state.lineSeen = stream.string;
|
34
|
-
state.basePos = state.overlayPos = stream.start;
|
35
|
-
}
|
36
|
-
|
37
39
|
if (stream.start == state.basePos) {
|
38
40
|
state.baseCur = base.token(stream, state.base);
|
39
41
|
state.basePos = stream.pos;
|
@@ -44,6 +46,7 @@ CodeMirror.overlayMode = CodeMirror.overlayParser = function(base, overlay, comb
|
|
44
46
|
state.overlayPos = stream.pos;
|
45
47
|
}
|
46
48
|
stream.pos = Math.min(state.basePos, state.overlayPos);
|
49
|
+
if (stream.eol()) state.basePos = state.overlayPos = 0;
|
47
50
|
|
48
51
|
if (state.overlayCur == null) return state.baseCur;
|
49
52
|
if (state.baseCur != null && combine) return state.baseCur + " " + state.overlayCur;
|
@@ -63,3 +66,5 @@ CodeMirror.overlayMode = CodeMirror.overlayParser = function(base, overlay, comb
|
|
63
66
|
}
|
64
67
|
};
|
65
68
|
};
|
69
|
+
|
70
|
+
});
|
@@ -1,4 +1,12 @@
|
|
1
|
-
|
1
|
+
(function(mod) {
|
2
|
+
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
3
|
+
mod(require("../../lib/codemirror"), require("./runmode"));
|
4
|
+
else if (typeof define == "function" && define.amd) // AMD
|
5
|
+
define(["../../lib/codemirror", "./runmode"], mod);
|
6
|
+
else // Plain browser env
|
7
|
+
mod(CodeMirror);
|
8
|
+
})(function(CodeMirror) {
|
9
|
+
"use strict";
|
2
10
|
|
3
11
|
var isBlock = /^(p|li|div|h\\d|pre|blockquote|td)$/;
|
4
12
|
|
@@ -10,7 +18,7 @@ CodeMirror.colorize = (function() {
|
|
10
18
|
}
|
11
19
|
}
|
12
20
|
|
13
|
-
|
21
|
+
CodeMirror.colorize = function(collection, defaultMode) {
|
14
22
|
if (!collection) collection = document.body.getElementsByTagName("pre");
|
15
23
|
|
16
24
|
for (var i = 0; i < collection.length; ++i) {
|
@@ -26,4 +34,4 @@ CodeMirror.colorize = (function() {
|
|
26
34
|
node.className += " cm-s-default";
|
27
35
|
}
|
28
36
|
};
|
29
|
-
})
|
37
|
+
});
|
@@ -1,3 +1,13 @@
|
|
1
|
+
(function(mod) {
|
2
|
+
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
3
|
+
mod(require("../../lib/codemirror"));
|
4
|
+
else if (typeof define == "function" && define.amd) // AMD
|
5
|
+
define(["../../lib/codemirror"], mod);
|
6
|
+
else // Plain browser env
|
7
|
+
mod(CodeMirror);
|
8
|
+
})(function(CodeMirror) {
|
9
|
+
"use strict";
|
10
|
+
|
1
11
|
CodeMirror.runMode = function(string, modespec, callback, options) {
|
2
12
|
var mode = CodeMirror.getMode(CodeMirror.defaults, modespec);
|
3
13
|
var ie = /MSIE \d/.test(navigator.userAgent);
|
@@ -54,3 +64,5 @@ CodeMirror.runMode = function(string, modespec, callback, options) {
|
|
54
64
|
}
|
55
65
|
}
|
56
66
|
};
|
67
|
+
|
68
|
+
});
|
@@ -1,5 +1,7 @@
|
|
1
1
|
/* Just enough of CodeMirror to run runMode under node.js */
|
2
2
|
|
3
|
+
// declare global: StringStream
|
4
|
+
|
3
5
|
function splitLines(string){ return string.split(/\r?\n|\r/); };
|
4
6
|
|
5
7
|
function StringStream(string) {
|
@@ -112,3 +114,5 @@ exports.runMode = function(string, modespec, callback, options) {
|
|
112
114
|
}
|
113
115
|
}
|
114
116
|
};
|
117
|
+
|
118
|
+
require.cache[require.resolve("../../lib/codemirror")] = require.cache[require.resolve("./runmode.node")];
|
@@ -1,4 +1,11 @@
|
|
1
|
-
(function() {
|
1
|
+
(function(mod) {
|
2
|
+
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
3
|
+
mod(require("../../lib/codemirror"));
|
4
|
+
else if (typeof define == "function" && define.amd) // AMD
|
5
|
+
define(["../../lib/codemirror"], mod);
|
6
|
+
else // Plain browser env
|
7
|
+
mod(CodeMirror);
|
8
|
+
})(function(CodeMirror) {
|
2
9
|
"use strict";
|
3
10
|
|
4
11
|
CodeMirror.defineOption("scrollPastEnd", false, function(cm, val, old) {
|
@@ -33,4 +40,4 @@
|
|
33
40
|
cm.setSize();
|
34
41
|
}
|
35
42
|
}
|
36
|
-
})
|
43
|
+
});
|
@@ -12,7 +12,16 @@
|
|
12
12
|
// actual CSS class name. showToken, when enabled, will cause the
|
13
13
|
// current token to be highlighted when nothing is selected.
|
14
14
|
|
15
|
-
(function() {
|
15
|
+
(function(mod) {
|
16
|
+
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
17
|
+
mod(require("../../lib/codemirror"));
|
18
|
+
else if (typeof define == "function" && define.amd) // AMD
|
19
|
+
define(["../../lib/codemirror"], mod);
|
20
|
+
else // Plain browser env
|
21
|
+
mod(CodeMirror);
|
22
|
+
})(function(CodeMirror) {
|
23
|
+
"use strict";
|
24
|
+
|
16
25
|
var DEFAULT_MIN_CHARS = 2;
|
17
26
|
var DEFAULT_TOKEN_STYLE = "matchhighlight";
|
18
27
|
var DEFAULT_DELAY = 100;
|
@@ -68,7 +77,7 @@
|
|
68
77
|
return;
|
69
78
|
}
|
70
79
|
if (cm.getCursor("head").line != cm.getCursor("anchor").line) return;
|
71
|
-
var selection = cm.
|
80
|
+
var selection = cm.getSelections()[0].replace(/^\s+|\s+$/g, "");
|
72
81
|
if (selection.length >= state.minChars)
|
73
82
|
cm.addOverlay(state.overlay = makeOverlay(selection, false, state.style));
|
74
83
|
});
|
@@ -88,4 +97,4 @@
|
|
88
97
|
stream.skipTo(query.charAt(0)) || stream.skipToEnd();
|
89
98
|
}};
|
90
99
|
}
|
91
|
-
})
|
100
|
+
});
|
@@ -6,23 +6,31 @@
|
|
6
6
|
// replace by making sure the match is no longer selected when hitting
|
7
7
|
// Ctrl-G.
|
8
8
|
|
9
|
-
(function() {
|
9
|
+
(function(mod) {
|
10
|
+
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
11
|
+
mod(require("../../lib/codemirror"), require("./searchcursor"), require("../dialog/dialog"));
|
12
|
+
else if (typeof define == "function" && define.amd) // AMD
|
13
|
+
define(["../../lib/codemirror", "./searchcursor", "../dialog/dialog"], mod);
|
14
|
+
else // Plain browser env
|
15
|
+
mod(CodeMirror);
|
16
|
+
})(function(CodeMirror) {
|
17
|
+
"use strict";
|
10
18
|
function searchOverlay(query, caseInsensitive) {
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
query = new RegExp(query.
|
15
|
-
|
19
|
+
var startChar;
|
20
|
+
if (typeof query == "string") {
|
21
|
+
startChar = query.charAt(0);
|
22
|
+
query = new RegExp("^" + query.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"),
|
23
|
+
caseInsensitive ? "i" : "");
|
24
|
+
} else {
|
25
|
+
query = new RegExp("^(?:" + query.source + ")", query.ignoreCase ? "i" : "");
|
26
|
+
}
|
16
27
|
return {token: function(stream) {
|
17
|
-
query
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
stream.pos = match.index;
|
24
|
-
} else {
|
25
|
-
stream.skipToEnd();
|
28
|
+
if (stream.match(query)) return "searching";
|
29
|
+
while (!stream.eol()) {
|
30
|
+
stream.next();
|
31
|
+
if (startChar && !caseInsensitive)
|
32
|
+
stream.skipTo(startChar) || stream.skipToEnd();
|
33
|
+
if (stream.match(query, false)) break;
|
26
34
|
}
|
27
35
|
}};
|
28
36
|
}
|
@@ -144,4 +152,4 @@
|
|
144
152
|
CodeMirror.commands.clearSearch = clearSearch;
|
145
153
|
CodeMirror.commands.replace = replace;
|
146
154
|
CodeMirror.commands.replaceAll = function(cm) {replace(cm, true);};
|
147
|
-
})
|
155
|
+
});
|
@@ -1,4 +1,12 @@
|
|
1
|
-
(function(){
|
1
|
+
(function(mod) {
|
2
|
+
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
3
|
+
mod(require("../../lib/codemirror"));
|
4
|
+
else if (typeof define == "function" && define.amd) // AMD
|
5
|
+
define(["../../lib/codemirror"], mod);
|
6
|
+
else // Plain browser env
|
7
|
+
mod(CodeMirror);
|
8
|
+
})(function(CodeMirror) {
|
9
|
+
"use strict";
|
2
10
|
var Pos = CodeMirror.Pos;
|
3
11
|
|
4
12
|
function SearchCursor(doc, query, pos, caseFold) {
|
@@ -164,4 +172,15 @@
|
|
164
172
|
CodeMirror.defineDocExtension("getSearchCursor", function(query, pos, caseFold) {
|
165
173
|
return new SearchCursor(this, query, pos, caseFold);
|
166
174
|
});
|
167
|
-
|
175
|
+
|
176
|
+
CodeMirror.defineExtension("selectMatches", function(query, caseFold) {
|
177
|
+
var ranges = [], next;
|
178
|
+
var cur = this.getSearchCursor(query, this.getCursor("from"), caseFold);
|
179
|
+
while (next = cur.findNext()) {
|
180
|
+
if (CodeMirror.cmpPos(cur.to(), this.getCursor("to")) > 0) break;
|
181
|
+
ranges.push({anchor: cur.from(), head: cur.to()});
|
182
|
+
}
|
183
|
+
if (ranges.length)
|
184
|
+
this.setSelections(ranges, 0);
|
185
|
+
});
|
186
|
+
});
|
@@ -4,7 +4,14 @@
|
|
4
4
|
// active line's wrapping <div> the CSS class "CodeMirror-activeline",
|
5
5
|
// and gives its background <div> the class "CodeMirror-activeline-background".
|
6
6
|
|
7
|
-
(function() {
|
7
|
+
(function(mod) {
|
8
|
+
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
9
|
+
mod(require("../../lib/codemirror"));
|
10
|
+
else if (typeof define == "function" && define.amd) // AMD
|
11
|
+
define(["../../lib/codemirror"], mod);
|
12
|
+
else // Plain browser env
|
13
|
+
mod(CodeMirror);
|
14
|
+
})(function(CodeMirror) {
|
8
15
|
"use strict";
|
9
16
|
var WRAP_CLASS = "CodeMirror-activeline";
|
10
17
|
var BACK_CLASS = "CodeMirror-activeline-background";
|
@@ -12,34 +19,48 @@
|
|
12
19
|
CodeMirror.defineOption("styleActiveLine", false, function(cm, val, old) {
|
13
20
|
var prev = old && old != CodeMirror.Init;
|
14
21
|
if (val && !prev) {
|
15
|
-
|
22
|
+
cm.state.activeLines = [];
|
23
|
+
updateActiveLines(cm, cm.listSelections());
|
16
24
|
cm.on("beforeSelectionChange", selectionChange);
|
17
25
|
} else if (!val && prev) {
|
18
26
|
cm.off("beforeSelectionChange", selectionChange);
|
19
|
-
|
20
|
-
delete cm.state.
|
27
|
+
clearActiveLines(cm);
|
28
|
+
delete cm.state.activeLines;
|
21
29
|
}
|
22
30
|
});
|
23
31
|
|
24
|
-
function
|
25
|
-
|
26
|
-
cm.removeLineClass(cm.state.
|
27
|
-
cm.removeLineClass(cm.state.
|
32
|
+
function clearActiveLines(cm) {
|
33
|
+
for (var i = 0; i < cm.state.activeLines.length; i++) {
|
34
|
+
cm.removeLineClass(cm.state.activeLines[i], "wrap", WRAP_CLASS);
|
35
|
+
cm.removeLineClass(cm.state.activeLines[i], "background", BACK_CLASS);
|
28
36
|
}
|
29
37
|
}
|
30
38
|
|
31
|
-
function
|
32
|
-
|
33
|
-
|
39
|
+
function sameArray(a, b) {
|
40
|
+
if (a.length != b.length) return false;
|
41
|
+
for (var i = 0; i < a.length; i++)
|
42
|
+
if (a[i] != b[i]) return false;
|
43
|
+
return true;
|
44
|
+
}
|
45
|
+
|
46
|
+
function updateActiveLines(cm, ranges) {
|
47
|
+
var active = [];
|
48
|
+
for (var i = 0; i < ranges.length; i++) {
|
49
|
+
var line = cm.getLineHandleVisualStart(ranges[i].head.line);
|
50
|
+
if (active[active.length - 1] != line) active.push(line);
|
51
|
+
}
|
52
|
+
if (sameArray(cm.state.activeLines, active)) return;
|
34
53
|
cm.operation(function() {
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
54
|
+
clearActiveLines(cm);
|
55
|
+
for (var i = 0; i < active.length; i++) {
|
56
|
+
cm.addLineClass(active[i], "wrap", WRAP_CLASS);
|
57
|
+
cm.addLineClass(active[i], "background", BACK_CLASS);
|
58
|
+
}
|
59
|
+
cm.state.activeLines = active;
|
39
60
|
});
|
40
61
|
}
|
41
62
|
|
42
63
|
function selectionChange(cm, sel) {
|
43
|
-
|
64
|
+
updateActiveLines(cm, sel.ranges);
|
44
65
|
}
|
45
|
-
})
|
66
|
+
});
|