##// END OF EJS Templates
update CodeMirror2 to 2.32
update CodeMirror2 to 2.32

File last commit:

r8053:58574fbf
r8053:58574fbf
Show More
overlay.js
52 lines | 1.9 KiB | application/javascript | JavascriptLexer
Brian E. Granger
Updating CodeMirror to v 2.12....
r4504 // Utility function that allows modes to be combined. The mode given
// as the base argument takes care of most of the normal mode
// functionality, but a second (typically simple) mode is used, which
// can override the style of text. Both modes get to parse all of the
// text, but when both assign a non-null style to a piece of code, the
// overlay wins, unless the combine argument was true, in which case
// the styles are combined.
Matthias BUSSONNIER
update CodeMirror2 to 2.32
r8053 // overlayParser is the old, deprecated name
CodeMirror.overlayMode = CodeMirror.overlayParser = function(base, overlay, combine) {
Brian E. Granger
Updating CodeMirror to v 2.12....
r4504 return {
startState: function() {
return {
base: CodeMirror.startState(base),
overlay: CodeMirror.startState(overlay),
basePos: 0, baseCur: null,
overlayPos: 0, overlayCur: null
};
},
copyState: function(state) {
return {
base: CodeMirror.copyState(base, state.base),
overlay: CodeMirror.copyState(overlay, state.overlay),
basePos: state.basePos, baseCur: null,
overlayPos: state.overlayPos, overlayCur: null
};
},
token: function(stream, state) {
if (stream.start == state.basePos) {
state.baseCur = base.token(stream, state.base);
state.basePos = stream.pos;
}
if (stream.start == state.overlayPos) {
stream.pos = stream.start;
state.overlayCur = overlay.token(stream, state.overlay);
state.overlayPos = stream.pos;
}
stream.pos = Math.min(state.basePos, state.overlayPos);
if (stream.eol()) state.basePos = state.overlayPos = 0;
if (state.overlayCur == null) return state.baseCur;
if (state.baseCur != null && combine) return state.baseCur + " " + state.overlayCur;
else return state.overlayCur;
},
Brian Granger
Updating to CodeMirror 2.2, latest stable release.
r5941
Matthias BUSSONNIER
update CodeMirror2 to 2.32
r8053 indent: base.indent && function(state, textAfter) {
Brian E. Granger
Updating CodeMirror to v 2.12....
r4504 return base.indent(state.base, textAfter);
},
electricChars: base.electricChars
};
};