Closed Bug 86093 Opened 24 years ago Closed 19 years ago

Tab chars in html source show up as "[]" (square) in Error Console

Categories

(Core Graveyard :: Error Console, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: bugzilla, Assigned: zeniko)

Details

Attachments

(2 files, 3 obsolete files)

If you have a warning or error in a line in a html document that contains a tab chars, the tab chars get shown as [] in the JavaScript console. ala: Warning: redeclaration of var i Source File: http://dev.gemal.dk/gemal.dk/en/browserspy/profile.html Line: 23, Column: 13 Source Code: [][]for (var i = 0; i < fields.length; i++) Will attach screenshot: Expected: Either tabs should be removed or replaced by 2 spaces
->hewitt
Assignee: pchen → hewitt
Status: NEW → ASSIGNED
Priority: -- → P5
Target Milestone: --- → Future
Component: XP Apps → JavaScript Console
QA Contact: sairuh → jrgm
\n chars are also shown as [] in the console.
Attached patch patch to fix tabs and newlines (obsolete) — Splinter Review
Keywords: patch, review
Attached patch patch version 2 (obsolete) — Splinter Review
Attachment #77426 - Attachment is obsolete: true
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 indentation then it'll be r=db48x
Attachment #77428 - Flags: needs-work+
Attached patch better patch. now using a style (obsolete) — Splinter Review
Attachment #77428 - Attachment is obsolete: true
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.
Summary: Tab chars in html source show up as "[]" (square) in JavaScript console → Tab chars in html source show up as "[]" (square) in Error Console
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.
Attachment #229232 - Flags: superreview?(neil)
Attachment #229232 - Flags: review?(mconnor)
Target Milestone: Future → ---
Attachment #229232 - Flags: superreview?(neil) → superreview+
Assignee: hewitt → zeniko
Status: ASSIGNED → NEW
Priority: P5 → --
QA Contact: jrgmorrison → error-console
Attachment #229232 - Flags: review?(mconnor) → review?(gavin.sharp)
Attachment #229232 - Flags: review?(gavin.sharp) → review+
Whiteboard: [checkin needed]
mozilla/toolkit/components/console/content/consoleBindings.xml 1.17 mozilla/xpfe/components/console/resources/content/consoleBindings.xml 1.29
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Whiteboard: [checkin needed]
Attachment #77434 - Attachment is obsolete: true
Product: Core → SeaMonkey
Product: SeaMonkey → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: