classification
Title: Idle: change default reformat width from 70 to 72
Type: enhancement Stage: resolved
Components: IDLE Versions: Python 3.5, Python 3.4, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Saimadhav.Heblikar, terry.reedy
Priority: normal Keywords: patch

Created on 2014-04-03 02:29 by terry.reedy, last changed 2014-04-22 05:33 by terry.reedy. This issue is now closed.

Files
File name Uploaded Description Edit
issue21139-27.patch Saimadhav.Heblikar, 2014-04-08 16:12 review
issue21139-34.patch Saimadhav.Heblikar, 2014-04-08 16:12 review
21139-34-fpe.diff terry.reedy, 2014-04-16 04:43 review
Messages (6)
msg215417 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2014-04-03 02:29
PEP 8 specifies a limit of 72 chars for flowing text (comments, multiline strings). The current default limit for Idle's Format / Reformat Paragraph is 70. Increase it to PEP 8's 72.
msg215714 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2014-04-07 18:14
Changing the default in the default configuration file is trivial. In test_formatparagraph.FormatEventTest, test_comment_block and test_long_line currently fail if the reformat width is changed on the General tab of the configuration dialog. These tests will need to be altered when the default is changed. Also, the tests should temporarily change the reformat width to the presumed default in the class setup and teardown methods. If this is not possible, the tests should be skipped if it is not what the test requires.
msg215771 - (view) Author: Saimadhav Heblikar (Saimadhav.Heblikar) * Date: 2014-04-08 16:12
Attaching a patch for 2.7 and 3.4
The comment strings are modified to reflect 70->72 in the tests.
msg216432 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2014-04-16 04:43
I am puzzled at the differences between the 2.7 and 3.4 patches. There are only three differences between the files

- from Tkinter import Tk, Text, TclError
+ from tkinter import Tk, Text, TclError
?      ^
- from test.test_support import requires
+ from test.support import requires
?           ^
-     get_selection_indices = EditorWindow.get_selection_indices.im_func
+     get_selection_indices = EditorWindow. get_selection_indices
 
and none of these should affect the patch.

The attached patch adds a limit parameter to the FormatParagraph.format_paragraph_event method ReformatParagraph.py that is called as self.formatter in the tests.
  cls.formatter = fp.FormatParagraph(editor).format_paragraph_event
With this change, we can augment the calls to
        self.formatter('ParameterDoesNothing', 72)
and the tests will ignore the configured value.
msg216986 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2014-04-22 05:17
I applied my patch as part of #21284. When I did so, I added 'limit=70' so that the tests pass otherwise unchanged. The only thing left here is to change config-main.def.
msg216989 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2014-04-22 05:33
I put 21138 in the commit message. The push messages are these.
New changeset 374746c5dedc by Terry Jan Reedy in branch '2.7':
Issue #21138: Change default reformat paragraph width to PEP 8's 72.
http://hg.python.org/cpython/rev/374746c5dedc

New changeset dd24099c0cf6 by Terry Jan Reedy in branch '3.4':
Issue #21138: Change default reformat paragraph width to PEP 8's 72.
http://hg.python.org/cpython/rev/dd24099c0cf6
History
Date User Action Args
2014-04-22 05:33:30terry.reedysetstatus: open -> closed
resolution: fixed
messages: + msg216989

stage: needs patch -> resolved
2014-04-22 05:17:09terry.reedysetmessages: + msg216986
2014-04-16 04:43:51terry.reedysetfiles: + 21139-34-fpe.diff

messages: + msg216432
2014-04-08 16:12:22Saimadhav.Heblikarsetfiles: + issue21139-34.patch
2014-04-08 16:12:02Saimadhav.Heblikarsetfiles: + issue21139-27.patch
keywords: + patch
messages: + msg215771
2014-04-07 18:14:27terry.reedysetmessages: + msg215714
2014-04-06 15:39:55Saimadhav.Heblikarsetnosy: + Saimadhav.Heblikar
2014-04-03 02:39:42terry.reedysetcomponents: + IDLE
2014-04-03 02:29:23terry.reedycreate