| OLD | NEW |
| 1 // CodeMirror, copyright (c) by Marijn Haverbeke and others | 1 // CodeMirror, copyright (c) by Marijn Haverbeke and others |
| 2 // Distributed under an MIT license: http://codemirror.net/LICENSE | 2 // Distributed under an MIT license: http://codemirror.net/LICENSE |
| 3 | 3 |
| 4 // Utility function that allows modes to be combined. The mode given | 4 // Utility function that allows modes to be combined. The mode given |
| 5 // as the base argument takes care of most of the normal mode | 5 // as the base argument takes care of most of the normal mode |
| 6 // functionality, but a second (typically simple) mode is used, which | 6 // functionality, but a second (typically simple) mode is used, which |
| 7 // can override the style of text. Both modes get to parse all of the | 7 // can override the style of text. Both modes get to parse all of the |
| 8 // text, but when both assign a non-null style to a piece of code, the | 8 // text, but when both assign a non-null style to a piece of code, the |
| 9 // overlay wins, unless the combine argument was true and not overridden, | 9 // overlay wins, unless the combine argument was true and not overridden, |
| 10 // or state.overlay.combineTokens was true, in which case the styles are | 10 // or state.overlay.combineTokens was true, in which case the styles are |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 }, | 69 }, |
| 70 | 70 |
| 71 indent: base.indent && function(state, textAfter) { | 71 indent: base.indent && function(state, textAfter) { |
| 72 return base.indent(state.base, textAfter); | 72 return base.indent(state.base, textAfter); |
| 73 }, | 73 }, |
| 74 electricChars: base.electricChars, | 74 electricChars: base.electricChars, |
| 75 | 75 |
| 76 innerMode: function(state) { return {state: state.base, mode: base}; }, | 76 innerMode: function(state) { return {state: state.base, mode: base}; }, |
| 77 | 77 |
| 78 blankLine: function(state) { | 78 blankLine: function(state) { |
| 79 if (base.blankLine) base.blankLine(state.base); | 79 var baseToken, overlayToken; |
| 80 if (overlay.blankLine) overlay.blankLine(state.overlay); | 80 if (base.blankLine) baseToken = base.blankLine(state.base); |
| 81 if (overlay.blankLine) overlayToken = overlay.blankLine(state.overlay); |
| 82 |
| 83 return overlayToken == null ? |
| 84 baseToken : |
| 85 (combine && baseToken != null ? baseToken + " " + overlayToken : overlay
Token); |
| 81 } | 86 } |
| 82 }; | 87 }; |
| 83 }; | 88 }; |
| 84 | 89 |
| 85 }); | 90 }); |
| OLD | NEW |