[issue36390] IDLE: Refactor formatting methods from editor

Terry J. Reedy report at bugs.python.org
Thu Jul 11 19:37:56 EDT 2019


Terry J. Reedy <tjreedy at udel.edu> added the comment:

I believe I meant the opposite of what I said, which fortunately is what Tal did.  PR 14500 is the one I looked at and commented on and the name change in PR 14500 is what needed to be included in PR 12481 (done).

I would like to retitle this issue 'IDLE: Move format functions into 1 file:. and put all the functions for the Format submenu in one file, format.py, with test_format.py.  The result will be near 400 lines.  Rename paragraph.py and test_paragraph.py and put contents of proposed new files in those instead.  Add another class, FormatFile for the 3 file reforming functions.

If you want, I would not mind merging the PR as is, but with 'region' removed from the names, and adding in FormatParagraph and a new FormatFile in a separate PR.  But I don't know the consequence for the file history and git blame.  I would prefer that format.py be seen as the successor of paragraph.py if that would enable blame to trace back through the rename.

paragraph already has some utility functions, including get_indent, which is similar to get_line_indent.  We might combine them in the follow-up refactoring.  There is at least one bug, mentioned in file, to fix.

Followup refactoring should include examination of docstrings and IDLE doc.  The doc should briefly define 'region'.

SimpleDialog.AskInteger should be replaced by a Query subclass both here and in EditorWindow.goto_line_event (another issue and PR).

Menu adjustments: Move Format Paragraph to top, leaving the 3 file operations together at the bottom.  ^[ also indents.  (Tab indents if more than one line is selected.)  Strip trailing whitespace should string trailing blank lines.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36390>
_______________________________________


More information about the Python-bugs-list mailing list