diff options
author | Nivesh Rajbhandari | 2012-02-20 11:14:44 -0800 |
---|---|---|
committer | Nivesh Rajbhandari | 2012-02-20 11:14:44 -0800 |
commit | abf78e2d7a97d295ce5a1c425fd359d47379137e (patch) | |
tree | d08c91bd2aef31e6325e0b499b2ffc390018bec6 /js/codemirror/lib/overlay.js | |
parent | e80a79bff57fecf3aa9b869d8ed2de5fd815287c (diff) | |
parent | e23708721a71ca4c71365f5f8e8ac7d6113926db (diff) | |
download | ninja-abf78e2d7a97d295ce5a1c425fd359d47379137e.tar.gz |
Merge branch 'refs/heads/ninja-internal' into ToolFixes
Diffstat (limited to 'js/codemirror/lib/overlay.js')
-rw-r--r-- | js/codemirror/lib/overlay.js | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/js/codemirror/lib/overlay.js b/js/codemirror/lib/overlay.js deleted file mode 100644 index c4cdf9fc..00000000 --- a/js/codemirror/lib/overlay.js +++ /dev/null | |||
@@ -1,51 +0,0 @@ | |||
1 | // Utility function that allows modes to be combined. The mode given | ||
2 | // as the base argument takes care of most of the normal mode | ||
3 | // functionality, but a second (typically simple) mode is used, which | ||
4 | // can override the style of text. Both modes get to parse all of the | ||
5 | // text, but when both assign a non-null style to a piece of code, the | ||
6 | // overlay wins, unless the combine argument was true, in which case | ||
7 | // the styles are combined. | ||
8 | |||
9 | CodeMirror.overlayParser = function(base, overlay, combine) { | ||
10 | return { | ||
11 | startState: function() { | ||
12 | return { | ||
13 | base: CodeMirror.startState(base), | ||
14 | overlay: CodeMirror.startState(overlay), | ||
15 | basePos: 0, baseCur: null, | ||
16 | overlayPos: 0, overlayCur: null | ||
17 | }; | ||
18 | }, | ||
19 | copyState: function(state) { | ||
20 | return { | ||
21 | base: CodeMirror.copyState(base, state.base), | ||
22 | overlay: CodeMirror.copyState(overlay, state.overlay), | ||
23 | basePos: state.basePos, baseCur: null, | ||
24 | overlayPos: state.overlayPos, overlayCur: null | ||
25 | }; | ||
26 | }, | ||
27 | |||
28 | token: function(stream, state) { | ||
29 | if (stream.start == state.basePos) { | ||
30 | state.baseCur = base.token(stream, state.base); | ||
31 | state.basePos = stream.pos; | ||
32 | } | ||
33 | if (stream.start == state.overlayPos) { | ||
34 | stream.pos = stream.start; | ||
35 | state.overlayCur = overlay.token(stream, state.overlay); | ||
36 | state.overlayPos = stream.pos; | ||
37 | } | ||
38 | stream.pos = Math.min(state.basePos, state.overlayPos); | ||
39 | if (stream.eol()) state.basePos = state.overlayPos = 0; | ||
40 | |||
41 | if (state.overlayCur == null) return state.baseCur; | ||
42 | if (state.baseCur != null && combine) return state.baseCur + " " + state.overlayCur; | ||
43 | else return state.overlayCur; | ||
44 | }, | ||
45 | |||
46 | indent: function(state, textAfter) { | ||
47 | return base.indent(state.base, textAfter); | ||
48 | }, | ||
49 | electricChars: base.electricChars | ||
50 | }; | ||
51 | }; | ||