Open Bug 1053917 Opened 10 years ago Updated 2 years ago

Make fill reject text with leading tabs

Categories

(Core :: DOM: Bindings (WebIDL), task, P3)

task

Tracking

()

People

(Reporter: mccr8, Unassigned)

References

(Blocks 1 open bug)

Details

textwrap.dedent() doesn't consider leading tabs and leading space to be the same, so if you have a mixture of the two, then fill just doesn't dedent at all, which leads to annoying failures to indent.  I can't imagine a situation where we want leading tabs, so maybe fill could throw an exception somewhere if a line starts with or contains a tab character.  (I changed my editor to highlight tabs now so I won't be hit by this again, hopefully.)
I can't think of a reason to have tabs in there period, leading or not.  Would be totally fine with just rejecting tabs entirely.
To clarify the problem here:

We have a Python script that generates C++ code. The Python code includes fragments of C++ that get stitched together. Here's an example:

http://searchfox.org/mozilla-central/rev/0aed9484bd3e97206fd1949ee4a4992ef300a81f/dom/bindings/Codegen.py#7123

It tries to line up the C++ code with the accompanying Python code, but it runs the C++ through dedent in order to get rid of the extra indentation when writing it out to a file.

Apparently this doesn't work if the C++ code contains a mix of spaces and tabs. So we should change the dedent function to reject tabs. This function is defined here:
http://searchfox.org/mozilla-central/rev/0aed9484bd3e97206fd1949ee4a4992ef300a81f/dom/bindings/Codegen.py#148

It seems like we could do something like this:
raise ValueError("dedent string contains tabs")
Mentor: wmccloskey
Priority: -- → P3
Component: DOM → DOM: Core & HTML

Hi @billm, I am looking to make my first contribution to Firefox.
I would like to take up this bug. Could you assign it to me?

Flags: needinfo?(bill.mccloskey)

Bill no longer contributes to Firefox, so he won't be able to mentor you on this. I think I understand enough about what is going on here to help you, though.

Assignee: nobody → vishaliitr7
Mentor: bill.mccloskey
Flags: needinfo?(bill.mccloskey)
Type: defect → task
Component: DOM: Core & HTML → DOM: Bindings (WebIDL)

Hey Andrew, That would be great! Can you please assign it to me?

Yes, I already did.

Assignee: vishaliitr7 → nobody
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.