marijnh/CodeMirror — pull request #1366 by edsharp (2013-03-15 15:54:57+00:00)
Title: Patch to allow multi-line tags to have correct indentation

You might have a better way of solving this problem than I have chosen! In particular, I don't like checking state.cc.length > 0 to know that I am in a tag definition, but it does seem rather reliable!

I added state.tagIdent that gets set when the tokenizer goes into inTag.
In turn this is added onto the context when pushContext is called.

This is then used as the reference for subsequent tags' indenting rather than context.indent which can be set incorrectly if a multi-line tag's attributes are indented further than the first line of the tag.

Imagine if you have indentUnit:4 and your XML style is that if you continue a tag across multiple lines, you indent the subsequent lines by two indentUnits (until the tag is closed). When you then press ENTER after closing your tag1, context.indent would be 8 and therefore the new tag starts indented at 12.

```xml

```

Whereas using the tagIndent as the base, that was set at 0 when

```