Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Idle: change default reformat width from 70 to 72 #65338

Closed
terryjreedy opened this issue Apr 3, 2014 · 6 comments
Closed

Idle: change default reformat width from 70 to 72 #65338

terryjreedy opened this issue Apr 3, 2014 · 6 comments
Labels
topic-IDLE type-feature A feature request or enhancement

Comments

@terryjreedy
Copy link
Member

BPO 21139
Nosy @terryjreedy
Files
  • issue21139-27.patch
  • issue21139-34.patch
  • 21139-34-fpe.diff
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2014-04-22.05:33:30.830>
    created_at = <Date 2014-04-03.02:29:23.539>
    labels = ['expert-IDLE', 'type-feature']
    title = 'Idle: change default reformat width from 70 to 72'
    updated_at = <Date 2014-04-22.05:33:30.828>
    user = 'https://github.com/terryjreedy'

    bugs.python.org fields:

    activity = <Date 2014-04-22.05:33:30.828>
    actor = 'terry.reedy'
    assignee = 'none'
    closed = True
    closed_date = <Date 2014-04-22.05:33:30.830>
    closer = 'terry.reedy'
    components = ['IDLE']
    creation = <Date 2014-04-03.02:29:23.539>
    creator = 'terry.reedy'
    dependencies = []
    files = ['34763', '34764', '34904']
    hgrepos = []
    issue_num = 21139
    keywords = ['patch']
    message_count = 6.0
    messages = ['215417', '215714', '215771', '216432', '216986', '216989']
    nosy_count = 2.0
    nosy_names = ['terry.reedy', 'Saimadhav.Heblikar']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue21139'
    versions = ['Python 2.7', 'Python 3.4', 'Python 3.5']

    @terryjreedy
    Copy link
    Member Author

    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.

    @terryjreedy terryjreedy added type-feature A feature request or enhancement topic-IDLE labels Apr 3, 2014
    @terryjreedy
    Copy link
    Member Author

    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.

    @SaimadhavHeblikar
    Copy link
    Mannequin

    SaimadhavHeblikar mannequin commented Apr 8, 2014

    Attaching a patch for 2.7 and 3.4
    The comment strings are modified to reflect 70->72 in the tests.

    @terryjreedy
    Copy link
    Member Author

    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.

    @terryjreedy
    Copy link
    Member Author

    I applied my patch as part of bpo-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.

    @terryjreedy
    Copy link
    Member Author

    I put 21138 in the commit message. The push messages are these.
    New changeset 374746c5dedc by Terry Jan Reedy in branch '2.7':
    Issue bpo-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 bpo-21138: Change default reformat paragraph width to PEP-8's 72.
    http://hg.python.org/cpython/rev/dd24099c0cf6

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    topic-IDLE type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant