Hi,
To find linebreaks (newline) on a project file I called via the AJAX object, I had to modify the plugin this way:
Exps.prototype.LastData = function (ret) { var str = this.lastData.replace(/\r?\n|\r/g,"\n"); ret.set_string(str); };
Dunno if I did it well enough but it seems that newline is only an alias of the js "\n"
But in windows I think linebreaks are a "\r\n" and the tokencount function gave me an extra character from the same string when I loaded it from a project file.
Develop games in your browser. Powerful, performant & highly capable.
Hmm... I'm worried this could subtly break other things. I've implemented the fix for the next build though, we'll see how it goes.
hmm I think you didn't implement it completely.
doing data.replace("\r\n","\n"); only replace the first occurence.
it seems you need the g flag for a global replacement as specified here
data.replace(/\r\n/g,"\n"); works
Huh, that's crazy. I didn't know Javascript's replace() only did the first occurrence when you use strings. Fixed for next build (won't changelog since it's very minor)