Closed Bug 926189 Opened 11 years ago Closed 8 years ago

Variables View: String display mustn't strip special characters such as line breaks

Categories

(DevTools :: Object Inspector, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1258584

People

(Reporter: till, Unassigned)

Details

Somewhat similar to bug 868276, but while \t is at least displayed (as whitespace) when editing the string, \n and \r just get stripped completely. For comparison, Chrome shows a character similar to "⏎" for \n and \r\n, (I guess) four spaces for \t, and strips \r.
Another option would be to just show whitespace characters (besides regular spaces) as their escaped representation e.g. "\n" for newline.
Would we then show the escaped versions with a leading "\\"? That'd work, I guess, and make them directly copyable as JS string literals.
Yeah I guess we'd also have to escape actual backslashes. This is what node.js's REPL does. It also escapes quotes as necessary, so every string is copy pastable as valid js code to make that string. `string.toSource()` does that for us here, so that would be a simple way to accomplish this.
Since toSource shows all primitives as objects (bug 879554) you have to do `string.toSource().slice(12, -2)`.
Closing this one as a dup since the other one has the start of a patch.
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → DUPLICATE
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.