browser/devtools/sourceeditor/codemirror/trailingspace.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 (function(mod) {
     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
     7     mod(CodeMirror);
     8 })(function(CodeMirror) {
     9   CodeMirror.defineOption("showTrailingSpace", false, function(cm, val, prev) {
    10     if (prev == CodeMirror.Init) prev = false;
    11     if (prev && !val)
    12       cm.removeOverlay("trailingspace");
    13     else if (!prev && val)
    14       cm.addOverlay({
    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; }
    18           stream.pos = l;
    19           return "trailingspace";
    20         },
    21         name: "trailingspace"
    22       });
    23   });
    24 });

mercurial