GPQAPP
1// CodeMirror, copyright (c) by Marijn Haverbeke and others
2// Distributed under an MIT license: https://codemirror.net/LICENSE
3
4(function(mod) {5if (typeof exports == "object" && typeof module == "object") // CommonJS6mod(require("../../lib/codemirror"));7else if (typeof define == "function" && define.amd) // AMD8define(["../../lib/codemirror"], mod);9else // Plain browser env10mod(CodeMirror);11})(function(CodeMirror) {12CodeMirror.defineOption("showTrailingSpace", false, function(cm, val, prev) {13if (prev == CodeMirror.Init) prev = false;14if (prev && !val)15cm.removeOverlay("trailingspace");16else if (!prev && val)17cm.addOverlay({18token: function(stream) {19for (var l = stream.string.length, i = l; i && /\s/.test(stream.string.charAt(i - 1)); --i) {}20if (i > stream.pos) { stream.pos = i; return null; }21stream.pos = l;22return "trailingspace";23},24name: "trailingspace"25});26});27});28