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 ++- imports/codemirror/mode/stex/test.html | 251 +++++++++++++++++++++++++++++++++ 2 files changed, 266 insertions(+), 2 deletions(-) create mode 100644 imports/codemirror/mode/stex/test.html (limited to 'imports/codemirror/mode/stex') 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==']') { diff --git a/imports/codemirror/mode/stex/test.html b/imports/codemirror/mode/stex/test.html new file mode 100644 index 00000000..b53a6a24 --- /dev/null +++ b/imports/codemirror/mode/stex/test.html @@ -0,0 +1,251 @@ + + + + CodeMirror: sTeX mode + + + + + + + + +

Tests for the sTeX Mode

+

Basics

+ + +

Tags

+ + +

Comments

+ + +

Errors

+ + +

Character Escapes

+ + +

Spacing control

+ + + +

Summary

+ + + + + -- cgit v1.2.3