This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author philwebster
Recipients Todd.Rovito, philwebster, terry.reedy
Date 2013-08-12.23:20:51
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1376349651.66.0.0872350340889.issue18583@psf.upfronthosting.co.za>
In-reply-to
Content
I've attached a patch that attempts to address the issues above. For the tests, I made some changes because the cursor doesn't end in exactly the same spot with line endings.

Here's a quick summary of the changes:
1. Removed format_paragraph and format_comment methods because all text is treated the same and formatted in the event method. (The formatting code could be pulled out of the format_event method if needed.)

2. Added find_string_indices method to see if cursor is in string using the text widget's string tag. If the cursor is in a string, only the string lines are formatted. Before, if code immediately preceded or followed the string at the same indentation level, it was treated as part of the same paragraph.

3. If the text to be formatted ends with a triple quoted string on its own line (such as a docstring), the formatting code leaves the line alone.

4. If selection contains multiple paragraphs (separated by blank lines), it can format each one. Previously, only the first paragraph was formatted.

Once I have some feedback, I can thoroughly check all of the tests and make sure that we're getting the expected behavior.
History
Date User Action Args
2013-08-12 23:20:51philwebstersetrecipients: + philwebster, terry.reedy, Todd.Rovito
2013-08-12 23:20:51philwebstersetmessageid: <1376349651.66.0.0872350340889.issue18583@psf.upfronthosting.co.za>
2013-08-12 23:20:51philwebsterlinkissue18583 messages
2013-08-12 23:20:51philwebstercreate