classification
Title: IDLE: Code cleanup on codecontext
Type: enhancement Stage: resolved
Components: IDLE Versions: Python 3.8, Python 3.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: terry.reedy Nosy List: cheryl.sabella, miss-islington, terry.reedy
Priority: normal Keywords: patch

Created on 2018-05-23 23:48 by cheryl.sabella, last changed 2018-05-24 03:52 by terry.reedy. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 7085 merged cheryl.sabella, 2018-05-23 23:54
PR 7091 merged miss-islington, 2018-05-24 02:19
PR 7092 merged miss-islington, 2018-05-24 02:20
Messages (5)
msg317479 - (view) Author: Cheryl Sabella (cheryl.sabella) * (Python committer) Date: 2018-05-23 23:48
Based on the github comments on PR5638, some code cleanup issues identified for codecontext.

codecontext
* getspacesfirstword - function and param1 name
* get_line_info - make into helper function and change parm
* get_context - call to get_line_info sends text instead of line number
* toggle_code_context_event - move border calc to same loop at padx
* cleanup some comments

test_codecontext
* test_get_line_info - move test to helper test class and change parm from line number to line
* test_get_line_info - add test for tab (I noticed 'indent' is 1 when the regex matches to a tab.  Even though IDLE doesn't allow tabs in the editor, I didn't want to lose track of this).
* test_getspacesfirstword - function name
* test_del - remove call to after info
msg317505 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-05-24 02:10
Super list.  It made the diff really easy to parse into related changes.  I printed it, reviewed code for items one by one, made a few changes, and checked them off when satisfied.

IDLE *does* (sort of) allow tabs.  One can read a file with tabs or Format => Tabify.  Config-main.def still has 'use-spaces= 1' and I believe it is still read and acted on, at least in some places. (This is, of course, untested.) The option to turn it off on the dialog has been removed, but I believe it still could be turned off by hand-editing .idlerc/config-main.cfg.  Of course, since 3.x rejects mixtures, beginners should expand tabs before editing existing files.

I have thought about possibly reviewing the tab situation, but in the absence of people having problems with the status quo, it is very low priority.  Maybe after 3.8 and the end of 2.x support.
msg317508 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-05-24 02:18
New changeset 8506016f904ba6bc27bf5261f27a0bdd5945cd26 by Terry Jan Reedy (Cheryl Sabella) in branch 'master':
 bpo-33628: IDLE: Minor code cleanup of codecontext.py and its tests  (GH-7085)
https://github.com/python/cpython/commit/8506016f904ba6bc27bf5261f27a0bdd5945cd26
msg317519 - (view) Author: miss-islington (miss-islington) Date: 2018-05-24 03:16
New changeset 935c81bbbca28ca23862d7ee1f79cd502e447edd by Miss Islington (bot) in branch '3.6':
bpo-33628: IDLE: Minor code cleanup of codecontext.py and its tests  (GH-7085)
https://github.com/python/cpython/commit/935c81bbbca28ca23862d7ee1f79cd502e447edd
msg317520 - (view) Author: miss-islington (miss-islington) Date: 2018-05-24 03:26
New changeset b2ab5dc72b36d074a86f2b1d91ae804e5a7210f8 by Miss Islington (bot) in branch '3.7':
bpo-33628: IDLE: Minor code cleanup of codecontext.py and its tests  (GH-7085)
https://github.com/python/cpython/commit/b2ab5dc72b36d074a86f2b1d91ae804e5a7210f8
History
Date User Action Args
2018-05-24 03:52:14terry.reedysetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2018-05-24 03:26:56miss-islingtonsetmessages: + msg317520
2018-05-24 03:16:43miss-islingtonsetnosy: + miss-islington
messages: + msg317519
2018-05-24 02:20:24miss-islingtonsetpull_requests: + pull_request6728
2018-05-24 02:19:24miss-islingtonsetpull_requests: + pull_request6727
2018-05-24 02:18:17terry.reedysetmessages: + msg317508
2018-05-24 02:10:52terry.reedysetmessages: + msg317505
2018-05-23 23:54:39cheryl.sabellasetkeywords: + patch
stage: patch review
pull_requests: + pull_request6718
2018-05-23 23:53:14cheryl.sabellalinkissue33610 dependencies
2018-05-23 23:48:33cheryl.sabellacreate