PluginProbe
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor / 2.0.4
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor v2.0.4
4.0.2 4.0.1 4.0.0 3.16.6 3.16.5 3.16.4 3.16.3 3.16.2 3.16.1 3.16.0 3.15.9 3.9.9 3.9.5 3.9.6 3.9.7 3.9.8 1.1.7 1.1.8 1.1.9 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 All 340 releases
profile-builder / assets / lib / codemirror / addon / mode / overlay.js

overlay.js in User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor 2.0.4, at assets/lib/codemirror/addon/mode/overlay.js

60 lines 2.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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 // overlayParser is the old, deprecated name
10 CodeMirror.overlayMode = CodeMirror.overlayParser = function(base, overlay, combine) {
11 return {
12 startState: function() {
13 return {
14 base: CodeMirror.startState(base),
15 overlay: CodeMirror.startState(overlay),
16 basePos: 0, baseCur: null,
17 overlayPos: 0, overlayCur: null
18 };
19 },
20 copyState: function(state) {
21 return {
22 base: CodeMirror.copyState(base, state.base),
23 overlay: CodeMirror.copyState(overlay, state.overlay),
24 basePos: state.basePos, baseCur: null,
25 overlayPos: state.overlayPos, overlayCur: null
26 };
27 },
28
29 token: function(stream, state) {
30 if (stream.start == state.basePos) {
31 state.baseCur = base.token(stream, state.base);
32 state.basePos = stream.pos;
33 }
34 if (stream.start == state.overlayPos) {
35 stream.pos = stream.start;
36 state.overlayCur = overlay.token(stream, state.overlay);
37 state.overlayPos = stream.pos;
38 }
39 stream.pos = Math.min(state.basePos, state.overlayPos);
40 if (stream.eol()) state.basePos = state.overlayPos = 0;
41
42 if (state.overlayCur == null) return state.baseCur;
43 if (state.baseCur != null && combine) return state.baseCur + " " + state.overlayCur;
44 else return state.overlayCur;
45 },
46
47 indent: base.indent && function(state, textAfter) {
48 return base.indent(state.base, textAfter);
49 },
50 electricChars: base.electricChars,
51
52 innerMode: function(state) { return {state: state.base, mode: base}; },
53
54 blankLine: function(state) {
55 if (base.blankLine) base.blankLine(state.base);
56 if (overlay.blankLine) overlay.blankLine(state.overlay);
57 }
58 };
59 };
60