Closed Bug 1568746 Opened 5 years ago Closed 5 years ago

Trim expressions before displaying them in Console messages

Categories

(DevTools :: Console, enhancement, P3)

enhancement

Tracking

(firefox70 fixed)

RESOLVED FIXED
Firefox 70
Tracking Status
firefox70 --- fixed

People

(Reporter: fvsch, Assigned: fvsch)

Details

Attachments

(2 files, 1 obsolete file)

Expressions like \n\n\nfoo\n\n\n are displayed in messages with all the line breaks intact, which creates big gaps in the console output.

This can be an issue with the new Editor mode, which makes it easier and more likely for users to have one or several start or end line breaks.

We should probably trim the expression before rendering it in messages.

Thanks for filing this issue Florens!
I agree we should trim before adding the message in the output

Priority: -- → P3

Tried a quick patch. I trims whitespace at the start and end, but also:

  • removes trailing whitespace for each line
  • keeps only 1 blank line

This is not quite Prettier, but the result seems nice.

Maybe the trailing whitespace and/or maxlines part are too opinionated. What do you think?

:fvsch, this looks good and seems lax enough to work make bad cases render in a space-saving way.

Assignee: nobody → florens
Status: NEW → ASSIGNED
Attachment #9081049 - Attachment is obsolete: true
Pushed by nchevobbe@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/46b354546ad8
Trim input text in Console messages; r=nchevobbe
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 70
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: