2 if (typeof exports
== "object" && typeof module
== "object") // CommonJS
3 mod(require("../../lib/codemirror"));
4 else if (typeof define
== "function" && define
.amd
) // AMD
5 define(["../../lib/codemirror"], mod
);
6 else // Plain browser env
8 })(function(CodeMirror
) {
9 CodeMirror
.defineOption("showTrailingSpace", false, function(cm
, val
, prev
) {
10 if (prev
== CodeMirror
.Init
) prev
= false;
12 cm
.removeOverlay("trailingspace");
13 else if (!prev
&& val
)
15 token: function(stream
) {
16 for (var l
= stream
.string
.length
, i
= l
; i
&& /\s/.test(stream
.string
.charAt(i
- 1)); --i
) {}
17 if (i
> stream
.pos
) { stream
.pos
= i
; return null; }
19 return "trailingspace";