codemirror-rails 3.02 → 3.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +1 -1
  3. data/LICENSE +1 -1
  4. data/codemirror-rails.gemspec +1 -0
  5. data/doc/CodeMirror-LICENSE +5 -1
  6. data/lib/codemirror/rails/version.rb +2 -2
  7. data/vendor/assets/javascripts/codemirror/{utils → addons/dialog}/dialog.js +4 -0
  8. data/vendor/assets/javascripts/codemirror/addons/display/placeholder.js +54 -0
  9. data/vendor/assets/javascripts/codemirror/addons/edit/closebrackets.js +54 -0
  10. data/vendor/assets/javascripts/codemirror/{utils → addons/edit}/closetag.js +9 -8
  11. data/vendor/assets/javascripts/codemirror/{utils → addons/edit}/continuecomment.js +12 -4
  12. data/vendor/assets/javascripts/codemirror/addons/edit/continuelist.js +25 -0
  13. data/vendor/assets/javascripts/codemirror/{utils → addons/edit}/matchbrackets.js +30 -11
  14. data/vendor/assets/javascripts/codemirror/addons/fold/brace-fold.js +31 -0
  15. data/vendor/assets/javascripts/codemirror/addons/fold/foldcode.js +32 -0
  16. data/vendor/assets/javascripts/codemirror/addons/fold/indent-fold.js +11 -0
  17. data/vendor/assets/javascripts/codemirror/addons/fold/xml-fold.js +64 -0
  18. data/vendor/assets/javascripts/codemirror/addons/hint/html-hint.js +582 -0
  19. data/vendor/assets/javascripts/codemirror/{utils → addons/hint}/javascript-hint.js +15 -11
  20. data/vendor/assets/javascripts/codemirror/{utils → addons/hint}/pig-hint.js +19 -19
  21. data/vendor/assets/javascripts/codemirror/{utils → addons/hint}/python-hint.js +2 -2
  22. data/vendor/assets/javascripts/codemirror/addons/hint/show-hint.js +180 -0
  23. data/vendor/assets/javascripts/codemirror/{utils → addons/hint}/xml-hint.js +5 -18
  24. data/vendor/assets/javascripts/codemirror/addons/lint/javascript-lint.js +127 -0
  25. data/vendor/assets/javascripts/codemirror/addons/lint/json-lint.js +14 -0
  26. data/vendor/assets/javascripts/codemirror/addons/lint/lint.js +197 -0
  27. data/vendor/assets/javascripts/codemirror/{utils → addons/mode}/loadmode.js +0 -0
  28. data/vendor/assets/javascripts/codemirror/{utils → addons/mode}/multiplex.js +2 -2
  29. data/vendor/assets/javascripts/codemirror/{utils → addons/mode}/overlay.js +2 -2
  30. data/vendor/assets/javascripts/codemirror/{utils → addons/runmode}/colorize.js +0 -0
  31. data/vendor/assets/javascripts/codemirror/{utils → addons/runmode}/runmode-standalone.js +2 -3
  32. data/vendor/assets/javascripts/codemirror/{utils → addons/runmode}/runmode.js +0 -0
  33. data/vendor/assets/javascripts/codemirror/addons/runmode/runmode.node.js +89 -0
  34. data/vendor/assets/javascripts/codemirror/addons/search/match-highlighter.js +60 -0
  35. data/vendor/assets/javascripts/codemirror/{utils → addons/search}/search.js +5 -5
  36. data/vendor/assets/javascripts/codemirror/{utils → addons/search}/searchcursor.js +37 -30
  37. data/vendor/assets/javascripts/codemirror/addons/selection/active-line.js +39 -0
  38. data/vendor/assets/javascripts/codemirror/addons/selection/mark-selection.js +34 -0
  39. data/vendor/assets/javascripts/codemirror/keymaps/vim.js +721 -188
  40. data/vendor/assets/javascripts/codemirror/modes/asterisk.js +6 -6
  41. data/vendor/assets/javascripts/codemirror/modes/clike.js +14 -14
  42. data/vendor/assets/javascripts/codemirror/modes/clojure.js +23 -7
  43. data/vendor/assets/javascripts/codemirror/modes/coffeescript.js +2 -2
  44. data/vendor/assets/javascripts/codemirror/modes/css.js +337 -235
  45. data/vendor/assets/javascripts/codemirror/modes/ecl.js +12 -12
  46. data/vendor/assets/javascripts/codemirror/modes/erlang.js +1 -1
  47. data/vendor/assets/javascripts/codemirror/modes/gas.js +326 -0
  48. data/vendor/assets/javascripts/codemirror/modes/gfm.js +1 -0
  49. data/vendor/assets/javascripts/codemirror/modes/haskell.js +26 -26
  50. data/vendor/assets/javascripts/codemirror/modes/haxe.js +17 -17
  51. data/vendor/assets/javascripts/codemirror/modes/htmlembedded.js +6 -6
  52. data/vendor/assets/javascripts/codemirror/modes/htmlmixed.js +43 -23
  53. data/vendor/assets/javascripts/codemirror/modes/javascript.js +78 -33
  54. data/vendor/assets/javascripts/codemirror/modes/jinja2.js +2 -2
  55. data/vendor/assets/javascripts/codemirror/modes/less.js +38 -38
  56. data/vendor/assets/javascripts/codemirror/modes/livescript.js +267 -0
  57. data/vendor/assets/javascripts/codemirror/modes/lua.js +7 -7
  58. data/vendor/assets/javascripts/codemirror/modes/markdown.js +108 -57
  59. data/vendor/assets/javascripts/codemirror/modes/mirc.js +177 -0
  60. data/vendor/assets/javascripts/codemirror/modes/ntriples.js +22 -22
  61. data/vendor/assets/javascripts/codemirror/modes/ocaml.js +1 -1
  62. data/vendor/assets/javascripts/codemirror/modes/perl.js +791 -791
  63. data/vendor/assets/javascripts/codemirror/modes/php.js +1 -1
  64. data/vendor/assets/javascripts/codemirror/modes/pig.js +163 -163
  65. data/vendor/assets/javascripts/codemirror/modes/python.js +31 -31
  66. data/vendor/assets/javascripts/codemirror/modes/q.js +124 -0
  67. data/vendor/assets/javascripts/codemirror/modes/rst.js +486 -250
  68. data/vendor/assets/javascripts/codemirror/modes/sass.js +3 -3
  69. data/vendor/assets/javascripts/codemirror/modes/scss_test.js +80 -0
  70. data/vendor/assets/javascripts/codemirror/modes/shell.js +2 -2
  71. data/vendor/assets/javascripts/codemirror/modes/sieve.js +10 -10
  72. data/vendor/assets/javascripts/codemirror/modes/smalltalk.js +129 -129
  73. data/vendor/assets/javascripts/codemirror/modes/smarty.js +3 -3
  74. data/vendor/assets/javascripts/codemirror/modes/sparql.js +1 -1
  75. data/vendor/assets/javascripts/codemirror/modes/sql.js +23 -23
  76. data/vendor/assets/javascripts/codemirror/modes/stex.js +192 -121
  77. data/vendor/assets/javascripts/codemirror/modes/tcl.js +131 -0
  78. data/vendor/assets/javascripts/codemirror/modes/test.js +64 -0
  79. data/vendor/assets/javascripts/codemirror/modes/tiddlywiki.js +345 -345
  80. data/vendor/assets/javascripts/codemirror/modes/tiki.js +297 -298
  81. data/vendor/assets/javascripts/codemirror/modes/turtle.js +145 -0
  82. data/vendor/assets/javascripts/codemirror/modes/vb.js +31 -32
  83. data/vendor/assets/javascripts/codemirror/modes/vbscript.js +4 -4
  84. data/vendor/assets/javascripts/codemirror/modes/xml.js +10 -6
  85. data/vendor/assets/javascripts/codemirror/modes/xquery.js +55 -55
  86. data/vendor/assets/javascripts/codemirror/modes/yaml.js +90 -90
  87. data/vendor/assets/javascripts/codemirror/modes/z80.js +82 -110
  88. data/vendor/assets/javascripts/codemirror.js +1914 -1115
  89. data/vendor/assets/stylesheets/codemirror/{utils → addons/dialog}/dialog.css +0 -0
  90. data/vendor/assets/stylesheets/codemirror/addons/hint/show-hint.css +38 -0
  91. data/vendor/assets/stylesheets/codemirror/addons/lint/lint.css +96 -0
  92. data/vendor/assets/stylesheets/codemirror/modes/tiki.css +2 -2
  93. data/vendor/assets/stylesheets/codemirror/themes/ambiance-mobile.css +0 -1
  94. data/vendor/assets/stylesheets/codemirror/themes/ambiance.css +0 -1
  95. data/vendor/assets/stylesheets/codemirror/themes/eclipse.css +2 -2
  96. data/vendor/assets/stylesheets/codemirror/themes/erlang-dark.css +5 -5
  97. data/vendor/assets/stylesheets/codemirror/themes/midnight.css +52 -0
  98. data/vendor/assets/stylesheets/codemirror/themes/xq-light.css +43 -0
  99. data/vendor/assets/stylesheets/codemirror.css +16 -10
  100. metadata +60 -52
  101. data/vendor/assets/javascripts/codemirror/modes/mysql.js +0 -203
  102. data/vendor/assets/javascripts/codemirror/modes/plsql.js +0 -216
  103. data/vendor/assets/javascripts/codemirror/utils/collapserange.js +0 -68
  104. data/vendor/assets/javascripts/codemirror/utils/continuelist.js +0 -28
  105. data/vendor/assets/javascripts/codemirror/utils/foldcode.js +0 -183
  106. data/vendor/assets/javascripts/codemirror/utils/formatting.js +0 -114
  107. data/vendor/assets/javascripts/codemirror/utils/match-highlighter.js +0 -46
  108. data/vendor/assets/javascripts/codemirror/utils/simple-hint.js +0 -102
  109. data/vendor/assets/stylesheets/codemirror/utils/simple-hint.css +0 -16
@@ -0,0 +1,145 @@
1
+ CodeMirror.defineMode("turtle", function(config) {
2
+ var indentUnit = config.indentUnit;
3
+ var curPunc;
4
+
5
+ function wordRegexp(words) {
6
+ return new RegExp("^(?:" + words.join("|") + ")$", "i");
7
+ }
8
+ var ops = wordRegexp([]);
9
+ var keywords = wordRegexp(["@prefix", "@base", "a"]);
10
+ var operatorChars = /[*+\-<>=&|]/;
11
+
12
+ function tokenBase(stream, state) {
13
+ var ch = stream.next();
14
+ curPunc = null;
15
+ if (ch == "<" && !stream.match(/^[\s\u00a0=]/, false)) {
16
+ stream.match(/^[^\s\u00a0>]*>?/);
17
+ return "atom";
18
+ }
19
+ else if (ch == "\"" || ch == "'") {
20
+ state.tokenize = tokenLiteral(ch);
21
+ return state.tokenize(stream, state);
22
+ }
23
+ else if (/[{}\(\),\.;\[\]]/.test(ch)) {
24
+ curPunc = ch;
25
+ return null;
26
+ }
27
+ else if (ch == "#") {
28
+ stream.skipToEnd();
29
+ return "comment";
30
+ }
31
+ else if (operatorChars.test(ch)) {
32
+ stream.eatWhile(operatorChars);
33
+ return null;
34
+ }
35
+ else if (ch == ":") {
36
+ return "operator";
37
+ } else {
38
+ stream.eatWhile(/[_\w\d]/);
39
+ if(stream.peek() == ":") {
40
+ return "variable-3";
41
+ } else {
42
+ var word = stream.current();
43
+
44
+ if(keywords.test(word)) {
45
+ return "meta";
46
+ }
47
+
48
+ if(ch >= "A" && ch <= "Z") {
49
+ return "comment";
50
+ } else {
51
+ return "keyword";
52
+ }
53
+ }
54
+ var word = stream.current();
55
+ if (ops.test(word))
56
+ return null;
57
+ else if (keywords.test(word))
58
+ return "meta";
59
+ else
60
+ return "variable";
61
+ }
62
+ }
63
+
64
+ function tokenLiteral(quote) {
65
+ return function(stream, state) {
66
+ var escaped = false, ch;
67
+ while ((ch = stream.next()) != null) {
68
+ if (ch == quote && !escaped) {
69
+ state.tokenize = tokenBase;
70
+ break;
71
+ }
72
+ escaped = !escaped && ch == "\\";
73
+ }
74
+ return "string";
75
+ };
76
+ }
77
+
78
+ function pushContext(state, type, col) {
79
+ state.context = {prev: state.context, indent: state.indent, col: col, type: type};
80
+ }
81
+ function popContext(state) {
82
+ state.indent = state.context.indent;
83
+ state.context = state.context.prev;
84
+ }
85
+
86
+ return {
87
+ startState: function() {
88
+ return {tokenize: tokenBase,
89
+ context: null,
90
+ indent: 0,
91
+ col: 0};
92
+ },
93
+
94
+ token: function(stream, state) {
95
+ if (stream.sol()) {
96
+ if (state.context && state.context.align == null) state.context.align = false;
97
+ state.indent = stream.indentation();
98
+ }
99
+ if (stream.eatSpace()) return null;
100
+ var style = state.tokenize(stream, state);
101
+
102
+ if (style != "comment" && state.context && state.context.align == null && state.context.type != "pattern") {
103
+ state.context.align = true;
104
+ }
105
+
106
+ if (curPunc == "(") pushContext(state, ")", stream.column());
107
+ else if (curPunc == "[") pushContext(state, "]", stream.column());
108
+ else if (curPunc == "{") pushContext(state, "}", stream.column());
109
+ else if (/[\]\}\)]/.test(curPunc)) {
110
+ while (state.context && state.context.type == "pattern") popContext(state);
111
+ if (state.context && curPunc == state.context.type) popContext(state);
112
+ }
113
+ else if (curPunc == "." && state.context && state.context.type == "pattern") popContext(state);
114
+ else if (/atom|string|variable/.test(style) && state.context) {
115
+ if (/[\}\]]/.test(state.context.type))
116
+ pushContext(state, "pattern", stream.column());
117
+ else if (state.context.type == "pattern" && !state.context.align) {
118
+ state.context.align = true;
119
+ state.context.col = stream.column();
120
+ }
121
+ }
122
+
123
+ return style;
124
+ },
125
+
126
+ indent: function(state, textAfter) {
127
+ var firstChar = textAfter && textAfter.charAt(0);
128
+ var context = state.context;
129
+ if (/[\]\}]/.test(firstChar))
130
+ while (context && context.type == "pattern") context = context.prev;
131
+
132
+ var closing = context && firstChar == context.type;
133
+ if (!context)
134
+ return 0;
135
+ else if (context.type == "pattern")
136
+ return context.col;
137
+ else if (context.align)
138
+ return context.col + (closing ? 0 : 1);
139
+ else
140
+ return context.indent + (closing ? 0 : indentUnit);
141
+ }
142
+ };
143
+ });
144
+
145
+ CodeMirror.defineMIME("text/turtle", "turtle");
@@ -1,10 +1,10 @@
1
1
  CodeMirror.defineMode("vb", function(conf, parserConf) {
2
2
  var ERRORCLASS = 'error';
3
-
3
+
4
4
  function wordRegexp(words) {
5
5
  return new RegExp("^((" + words.join(")|(") + "))\\b", "i");
6
6
  }
7
-
7
+
8
8
  var singleOperators = new RegExp("^[\\+\\-\\*/%&\\\\|\\^~<>!]");
9
9
  var singleDelimiters = new RegExp('^[\\(\\)\\[\\]\\{\\}@,:`=;\\.]');
10
10
  var doubleOperators = new RegExp("^((==)|(<>)|(<=)|(>=)|(<>)|(<<)|(>>)|(//)|(\\*\\*))");
@@ -15,9 +15,9 @@ CodeMirror.defineMode("vb", function(conf, parserConf) {
15
15
  var openingKeywords = ['class','module', 'sub','enum','select','while','if','function', 'get','set','property', 'try'];
16
16
  var middleKeywords = ['else','elseif','case', 'catch'];
17
17
  var endKeywords = ['next','loop'];
18
-
18
+
19
19
  var wordOperators = wordRegexp(['and', 'or', 'not', 'xor', 'in']);
20
- var commonkeywords = ['as', 'dim', 'break', 'continue','optional', 'then', 'until',
20
+ var commonkeywords = ['as', 'dim', 'break', 'continue','optional', 'then', 'until',
21
21
  'goto', 'byval','byref','new','handles','property', 'return',
22
22
  'const','private', 'protected', 'friend', 'public', 'shared', 'static', 'true','false'];
23
23
  var commontypes = ['integer','string','double','decimal','boolean','short','char', 'float','single'];
@@ -34,13 +34,13 @@ CodeMirror.defineMode("vb", function(conf, parserConf) {
34
34
 
35
35
  var indentInfo = null;
36
36
 
37
-
37
+
38
38
 
39
39
 
40
40
  function indent(_stream, state) {
41
41
  state.currentIndent++;
42
42
  }
43
-
43
+
44
44
  function dedent(_stream, state) {
45
45
  state.currentIndent--;
46
46
  }
@@ -49,16 +49,16 @@ CodeMirror.defineMode("vb", function(conf, parserConf) {
49
49
  if (stream.eatSpace()) {
50
50
  return null;
51
51
  }
52
-
52
+
53
53
  var ch = stream.peek();
54
-
54
+
55
55
  // Handle Comments
56
56
  if (ch === "'") {
57
57
  stream.skipToEnd();
58
58
  return 'comment';
59
59
  }
60
-
61
-
60
+
61
+
62
62
  // Handle Number Literals
63
63
  if (stream.match(/^((&H)|(&O))?[0-9\.a-f]/i, false)) {
64
64
  var floatLiteral = false;
@@ -66,7 +66,7 @@ CodeMirror.defineMode("vb", function(conf, parserConf) {
66
66
  if (stream.match(/^\d*\.\d+F?/i)) { floatLiteral = true; }
67
67
  else if (stream.match(/^\d+\.\d*F?/)) { floatLiteral = true; }
68
68
  else if (stream.match(/^\.\d+F?/)) { floatLiteral = true; }
69
-
69
+
70
70
  if (floatLiteral) {
71
71
  // Float literals may be "imaginary"
72
72
  stream.eat(/J/i);
@@ -93,13 +93,13 @@ CodeMirror.defineMode("vb", function(conf, parserConf) {
93
93
  return 'number';
94
94
  }
95
95
  }
96
-
96
+
97
97
  // Handle Strings
98
98
  if (stream.match(stringPrefixes)) {
99
99
  state.tokenize = tokenStringFactory(stream.current());
100
100
  return state.tokenize(stream, state);
101
101
  }
102
-
102
+
103
103
  // Handle operators and Delimiters
104
104
  if (stream.match(tripleDelimiters) || stream.match(doubleDelimiters)) {
105
105
  return null;
@@ -137,29 +137,29 @@ CodeMirror.defineMode("vb", function(conf, parserConf) {
137
137
  dedent(stream,state);
138
138
  return 'keyword';
139
139
  }
140
-
140
+
141
141
  if (stream.match(types)) {
142
142
  return 'keyword';
143
143
  }
144
-
144
+
145
145
  if (stream.match(keywords)) {
146
146
  return 'keyword';
147
147
  }
148
-
148
+
149
149
  if (stream.match(identifiers)) {
150
150
  return 'variable';
151
151
  }
152
-
152
+
153
153
  // Handle non-detected items
154
154
  stream.next();
155
155
  return ERRORCLASS;
156
156
  }
157
-
157
+
158
158
  function tokenStringFactory(delimiter) {
159
159
  var singleline = delimiter.length == 1;
160
160
  var OUTCLASS = 'string';
161
-
162
- return function tokenString(stream, state) {
161
+
162
+ return function(stream, state) {
163
163
  while (!stream.eol()) {
164
164
  stream.eatWhile(/[^'"]/);
165
165
  if (stream.match(delimiter)) {
@@ -179,7 +179,7 @@ CodeMirror.defineMode("vb", function(conf, parserConf) {
179
179
  return OUTCLASS;
180
180
  };
181
181
  }
182
-
182
+
183
183
 
184
184
  function tokenLexer(stream, state) {
185
185
  var style = state.tokenize(stream, state);
@@ -195,8 +195,8 @@ CodeMirror.defineMode("vb", function(conf, parserConf) {
195
195
  return ERRORCLASS;
196
196
  }
197
197
  }
198
-
199
-
198
+
199
+
200
200
  var delimiter_index = '[({'.indexOf(current);
201
201
  if (delimiter_index !== -1) {
202
202
  indent(stream, state );
@@ -212,7 +212,7 @@ CodeMirror.defineMode("vb", function(conf, parserConf) {
212
212
  return ERRORCLASS;
213
213
  }
214
214
  }
215
-
215
+
216
216
  return style;
217
217
  }
218
218
 
@@ -229,7 +229,7 @@ CodeMirror.defineMode("vb", function(conf, parserConf) {
229
229
 
230
230
  };
231
231
  },
232
-
232
+
233
233
  token: function(stream, state) {
234
234
  if (stream.sol()) {
235
235
  state.currentIndent += state.nextLineIndent;
@@ -237,24 +237,23 @@ CodeMirror.defineMode("vb", function(conf, parserConf) {
237
237
  state.doInCurrentLine = 0;
238
238
  }
239
239
  var style = tokenLexer(stream, state);
240
-
240
+
241
241
  state.lastToken = {style:style, content: stream.current()};
242
-
243
-
244
-
242
+
243
+
244
+
245
245
  return style;
246
246
  },
247
-
247
+
248
248
  indent: function(state, textAfter) {
249
249
  var trueText = textAfter.replace(/^\s+|\s+$/g, '') ;
250
250
  if (trueText.match(closing) || trueText.match(doubleClosing) || trueText.match(middle)) return conf.indentUnit*(state.currentIndent-1);
251
251
  if(state.currentIndent < 0) return 0;
252
252
  return state.currentIndent * conf.indentUnit;
253
253
  }
254
-
254
+
255
255
  };
256
256
  return external;
257
257
  });
258
258
 
259
259
  CodeMirror.defineMIME("text/x-vb", "vb");
260
-
@@ -6,12 +6,12 @@ CodeMirror.defineMode("vbscript", function() {
6
6
  if (stream.eatSpace()) return null;
7
7
  var ch = stream.next();
8
8
  if (ch == "'") {
9
- stream.skipToEnd();
10
- return "comment";
9
+ stream.skipToEnd();
10
+ return "comment";
11
11
  }
12
12
  if (ch == '"') {
13
- stream.skipTo('"');
14
- return "string";
13
+ stream.skipTo('"');
14
+ return "string";
15
15
  }
16
16
 
17
17
  if (/\w/.test(ch)) {
@@ -1,5 +1,7 @@
1
1
  CodeMirror.defineMode("xml", function(config, parserConfig) {
2
2
  var indentUnit = config.indentUnit;
3
+ var multilineTagIndentFactor = parserConfig.multilineTagIndentFactor || 1;
4
+
3
5
  var Kludges = parserConfig.htmlMode ? {
4
6
  autoSelfClosers: {'area': true, 'base': true, 'br': true, 'col': true, 'command': true,
5
7
  'embed': true, 'frame': true, 'hr': true, 'img': true, 'input': true,
@@ -84,7 +86,7 @@ CodeMirror.defineMode("xml", function(config, parserConfig) {
84
86
  var ok;
85
87
  if (stream.eat("#")) {
86
88
  if (stream.eat("x")) {
87
- ok = stream.eatWhile(/[a-fA-F\d]/) && stream.eat(";");
89
+ ok = stream.eatWhile(/[a-fA-F\d]/) && stream.eat(";");
88
90
  } else {
89
91
  ok = stream.eatWhile(/[\d]/) && stream.eat(";");
90
92
  }
@@ -165,7 +167,7 @@ CodeMirror.defineMode("xml", function(config, parserConfig) {
165
167
  };
166
168
  }
167
169
 
168
- var curState, setStyle;
170
+ var curState, curStream, setStyle;
169
171
  function pass() {
170
172
  for (var i = arguments.length - 1; i >= 0; i--) curState.cc.push(arguments[i]);
171
173
  }
@@ -191,6 +193,7 @@ CodeMirror.defineMode("xml", function(config, parserConfig) {
191
193
  function element(type) {
192
194
  if (type == "openTag") {
193
195
  curState.tagName = tagName;
196
+ curState.tagStart = curStream.column();
194
197
  return cont(attributes, endtag(curState.startOfLine));
195
198
  } else if (type == "closeTag") {
196
199
  var err = false;
@@ -212,7 +215,7 @@ CodeMirror.defineMode("xml", function(config, parserConfig) {
212
215
  function endtag(startOfLine) {
213
216
  return function(type) {
214
217
  var tagName = curState.tagName;
215
- curState.tagName = null;
218
+ curState.tagName = curState.tagStart = null;
216
219
  if (type == "selfcloseTag" ||
217
220
  (type == "endTag" && Kludges.autoSelfClosers.hasOwnProperty(tagName.toLowerCase()))) {
218
221
  maybePopContext(tagName.toLowerCase());
@@ -274,11 +277,11 @@ CodeMirror.defineMode("xml", function(config, parserConfig) {
274
277
 
275
278
  return {
276
279
  startState: function() {
277
- return {tokenize: inText, cc: [], indented: 0, startOfLine: true, tagName: null, context: null};
280
+ return {tokenize: inText, cc: [], indented: 0, startOfLine: true, tagName: null, tagStart: null, context: null};
278
281
  },
279
282
 
280
283
  token: function(stream, state) {
281
- if (stream.sol()) {
284
+ if (!state.tagName && stream.sol()) {
282
285
  state.startOfLine = true;
283
286
  state.indented = stream.indentation();
284
287
  }
@@ -288,7 +291,7 @@ CodeMirror.defineMode("xml", function(config, parserConfig) {
288
291
  var style = state.tokenize(stream, state);
289
292
  state.type = type;
290
293
  if ((style || type) && style != "comment") {
291
- curState = state;
294
+ curState = state; curStream = stream;
292
295
  while (true) {
293
296
  var comb = state.cc.pop() || element;
294
297
  if (comb(type || style)) break;
@@ -303,6 +306,7 @@ CodeMirror.defineMode("xml", function(config, parserConfig) {
303
306
  if ((state.tokenize != inTag && state.tokenize != inText) ||
304
307
  context && context.noIndent)
305
308
  return fullLine ? fullLine.match(/^(\s*)/)[0].length : 0;
309
+ if (state.tagName) return state.tagStart + indentUnit * multilineTagIndentFactor;
306
310
  if (alignCDATA && /<!\[CDATA\[/.test(textAfter)) return 0;
307
311
  if (context && /^<\//.test(textAfter))
308
312
  context = context.prev;