From 671d2b94996ac71d56b2d05d5fe694ed7d84fa59 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Wed, 4 Apr 2012 12:27:35 -0700 Subject: upgrading to CodeMirror 2.23, since it has an important fix to Not close Ninja, if backspace is pressed while autocomplete dropdown is open. Signed-off-by: Ananya Sen --- imports/codemirror/mode/stex/stex.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'imports/codemirror/mode/stex/stex.js') diff --git a/imports/codemirror/mode/stex/stex.js b/imports/codemirror/mode/stex/stex.js index bb47fb45..b89e619e 100644 --- a/imports/codemirror/mode/stex/stex.js +++ b/imports/codemirror/mode/stex/stex.js @@ -82,7 +82,7 @@ CodeMirror.defineMode("stex", function(cmCfg, modeCfg) } function normal(source, state) { - if (source.match(/^\\[a-z]+/)) { + if (source.match(/^\\[a-zA-Z@]+/)) { var cmdName = source.current(); cmdName = cmdName.substr(1, cmdName.length-1); var plug = plugins[cmdName]; @@ -95,9 +95,22 @@ CodeMirror.defineMode("stex", function(cmCfg, modeCfg) return plug.style; } + // escape characters + if (source.match(/^\\[$&%#{}_]/)) { + return "tag"; + } + + // white space control characters + if (source.match(/^\\[,;!\/]/)) { + return "tag"; + } + var ch = source.next(); if (ch == "%") { - setState(state, inCComment); + // special case: % at end of its own line; stay in same state + if (!source.eol()) { + setState(state, inCComment); + } return "comment"; } else if (ch=='}' || ch==']') { -- cgit v1.2.3