marijnh/CodeMirror — pull request #1020 by MasonM (2012-11-30 04:44:50+00:00)
Title: Support blank lines in CodeMirror.multiplexingMode

This adds a blankLine method that calls the current mode's blankLine if
it has one. It has allows switching on a blank line if "\n" is specified
for "open" or "close".

Use case: for an API client is writing, I'm showing the raw HTTP response in a CodeMirror editor. I want the HTTP headers to be highlighted by the "http" mode and the HTTP body to be highlighted by a different mode, depending on the response's content-type. In code:
```
setResponseEditorMode: function(innerModer) {
CodeMirror.defineMode("explorpcResponse", function(config) {
return CodeMirror.multiplexingMode(
CodeMirror.getMode(config, "message/http"), {
open: "\n",
close: "\0",
mode: CodeMirror.getMode(config, innerMode)
}
);
});
this._responseEditor.setOption('mode', 'explorpcResponse');
}

```