If you have a warning or error in a line in a html document that contains a tab
Warning: redeclaration of var i
Source File: http://dev.gemal.dk/gemal.dk/en/browserspy/profile.html
Line: 23, Column: 13
for (var i = 0; i < fields.length; i++)
Will attach screenshot:
Either tabs should be removed or replaced by 2 spaces
Created attachment 38612 [details]
tab chars get shown as  squares in console window
\n chars are also shown as  in the console.
Created attachment 77426 [details] [diff] [review]
patch to fix tabs and newlines
Created attachment 77428 [details] [diff] [review]
patch version 2
Comment on attachment 77428 [details] [diff] [review]
patch version 2
>+ // get rid of newlines and tabs
>+ var sourcetext= aObject.sourceLine;
space before the =
>+ sourcetext = sourcetext.replace(/[\n|\r]/g, "");
>+ sourcetext = sourcetext.replace(/^\t*/g, " ");
>+ sourcetext = sourcetext.replace(/\t/g, " ");
I'd make it do this instead:
+ sourcetext = sourcetext.replace(/\t/g, " ");
+ sourcetext = sourcetext.replace(/^\s*/, "");
and then change mozilla/xpfe/components/console/resources/content/console.css
so that the rule for .console-error-source has a margin-left to accomplish the
then it'll be r=db48x
Created attachment 77434 [details] [diff] [review]
better patch. now using a style
alecf: could you sr?
Erm... if you fiddle about with tabs like that you'll kill the error marker :-(
Why not row.setAttribute("code", aObject.sourceLine.replace(/[\x00-\x1F]/g, " "));
[Aside: what was a dynamic regexp doing there?]
let me know when this is sorted out. I'm not sure I agree with the replacement
of all characters < 0x1F though.
I don't know what tabs should be. I was going to suggest 8 spaces, myself :)
the error marker isn't usually correct anyway, as both the code and the marker
are shown in a varible width font, so even if we know what character the error
was on, we can't line it up right.
I say go ahead and check this patch in, and file the marker misalignment as a
seperate bug. (I'd also change it to display an <hr/> or just a border instead
of a bunch of dashes, so it would look prettier. That and the marker should
probably be indented the same was as the code so that it has a better chance of
lining up correctly.)
Actually the marker works fine in Classic, there's already a bug filed on that.
Created attachment 229232 [details] [diff] [review]
replace all whitespace characters with spaces
This patch simply replaces all whitespace characters which should prevent most of these irritating/useless squares (haven't seen any of them for over a year). The reason to replace every character with precisely one space is that otherwise the column marker will point to the wrong location since the column count is in plain characters.