2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-08 07:24:21 +00:00
betateilchen 058e14f2b1 codemirror: added for easy testing codemirror integration
see http://forum.fhem.de/index.php/topic,20444.0.html
*** may be deleted at any time! ***
*** will not be delivered via update until official release ***


git-svn-id: https://svn.fhem.de/fhem/trunk@5131 2b470e98-0d58-463d-a4d8-8e2adae1ed80
2014-03-04 20:34:05 +00:00

16 lines
528 B
JavaScript

CodeMirror.defineOption("showTrailingSpace", false, function(cm, val, prev) {
if (prev == CodeMirror.Init) prev = false;
if (prev && !val)
cm.removeOverlay("trailingspace");
else if (!prev && val)
cm.addOverlay({
token: function(stream) {
for (var l = stream.string.length, i = l; i && /\s/.test(stream.string.charAt(i - 1)); --i) {}
if (i > stream.pos) { stream.pos = i; return null; }
stream.pos = l;
return "trailingspace";
},
name: "trailingspace"
});
});