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.

classification
Title: IDLE: Display up to maxlines non-blank lines for Code Context
Type: enhancement Stage: resolved
Components: IDLE Versions: Python 3.8, Python 3.7, Python 3.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: terry.reedy Nosy List: cheryl.sabella, miss-islington, terry.reedy
Priority: normal Keywords: patch, patch

Created on 2018-05-25 00:41 by cheryl.sabella, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 7106 merged cheryl.sabella, 2018-05-25 00:47
PR 7332 merged miss-islington, 2018-06-01 23:23
PR 7333 merged miss-islington, 2018-06-01 23:24
PR 7500 merged terry.reedy, 2018-06-07 22:55
PR 7501 merged miss-islington, 2018-06-07 23:12
PR 7502 merged miss-islington, 2018-06-07 23:13
Messages (16)
msg317649 - (view) Author: Cheryl Sabella (cheryl.sabella) * (Python committer) Date: 2018-05-25 00:41
Item 7 from #33610:
Change fixed # of lines to variable # of lines as needed, up to limit.  About 15 is limit for 4-space indents in 80 char lines. 

* Change default number of lines to be 15 in config.
* Label in config dialog.
* Initialize context to be one blank line to show it's turned on.
* Remove padding of blank lines.
* Modify tests to show variable number of lines in context text instead of lines scrolling out of view.

Tip: For manual tests, help.py works really well in viewing 15 lines.
msg317652 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-05-25 00:59
2 quick thoughts.

1. I am not sure we can/should change the default, as it interacts with the recorded user changes for past versions.  The default is that we never change defaults.  (Having one user config for all Python/IDLE versions is a curse as well as a blessing.  I anticipate having to do something different, sometime.

2. I was thinking for '<top level>' instead of a blank line for when CC is on but there is no real context.  I think we should try both and see what seems better in use while moving down through a file.
msg317669 - (view) Author: Cheryl Sabella (cheryl.sabella) * (Python committer) Date: 2018-05-25 10:41
I know we usually don't change defaults, but I had tested this one and I think it works.  After I changed it to 15 lines in master, I opened the installed version of IDLE 2.7.  Although it showed 15 fixed lines, it made sense since that was the number of lines in the 3.8 version.

I figured a typical user would be using whichever version of IDLE comes with their current Python.  So, at some point the OS would upgrade it and they would be moving from a version with fixed lines to a version with variable lines (for Python 3).  If they had previously changed their settings, it would still use whatever they had changed it to as the limit, but now the context area would grow and shrink (so they would know the change exists).  If they hadn't customized their settings, it would just change from 3 to 15.

If the user switches between two versions (like when I tested with 2.7), then I think seeing the changes almost makes more sense to them.  They can see it at 15 in the new version and watch it grow and shrink.  Then it the 2.7 version, it looks the same, but without the expansion/contraction.  It's a demonstration of what makes the variable sizing nice to have.  Although it may lead to someone wanting it in 2.7.  :-)

Anyway, that was my thinking process.  When you try it out, you may not agree, but it made sense to me when I saw what was happening.

Note: one time this didn't quite work was when I set the line limit to 90.  3.8 worked great -- just like it had with 15 (that is, it never ate the whole editor window).  But, under 2.7, it ate the whole window and without the `reload` in codecontext, changing the config didn't help until I restarted IDLE.
msg317804 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-05-27 18:32
Unlinked duplicate PR entry.  I have no idea how that could happen.
msg317821 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-05-28 01:24
After testing the patch as a user, I would like 3 user-visible changes.

1. Only display a blank line when there are no context lines.

2. Replace the 'lines' option with a 'maxlines' option.  There is no need to worry about, or explain to users (see 3.) the possible complications of reusing 'lines' with a different meaning.

3. Add a 'maxlines' entry to the General tab help page.  I will work on this either first or second.

I will post other thoughts on the master issue, #33610.
msg317926 - (view) Author: Cheryl Sabella (cheryl.sabella) * (Python committer) Date: 2018-05-28 21:40
I pushed a commit for these three items.
msg318353 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-06-01 00:57
On Windows, I observe the following behaviors.

1. When Code Context is enabled on a windows still at its initial height, context lines are added to code lines to increase the window height.

2. When the window height is changed with a mouse, that becomes the fixed height, which is partitioned between context and code lines.  In other words, context lines are taken from and given back to code lines.

3. When height is maximized either with ZoomHeight or WindowMaximize, the behavior is as with 2.  When height is un-maximized, behavior reverts to what it was, either 1 or 2.

What do you see on Linux?
msg318464 - (view) Author: Cheryl Sabella (cheryl.sabella) * (Python committer) Date: 2018-06-01 21:06
I see similar behavior on Linux, except after maximizing and then minimizing, it seems to stay with option 2.
msg318473 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-06-01 23:23
New changeset 29996a1c4e8bd6dde6adce2b44d11a0982a47a3a by Terry Jan Reedy (Cheryl Sabella) in branch 'master':
bpo-33642: IDLE: Use variable number of lines in CodeContext. (GH-7106)
https://github.com/python/cpython/commit/29996a1c4e8bd6dde6adce2b44d11a0982a47a3a
msg318474 - (view) Author: miss-islington (miss-islington) Date: 2018-06-01 23:46
New changeset 0800b6c17a829ecb554d93cba8c97f92b15be52a by Miss Islington (bot) in branch '3.7':
bpo-33642: IDLE: Use variable number of lines in CodeContext. (GH-7106)
https://github.com/python/cpython/commit/0800b6c17a829ecb554d93cba8c97f92b15be52a
msg318475 - (view) Author: miss-islington (miss-islington) Date: 2018-06-02 00:08
New changeset a42fe3c67ca86ac08dc6f47af27eed089d35fdd0 by Miss Islington (bot) in branch '3.6':
bpo-33642: IDLE: Use variable number of lines in CodeContext. (GH-7106)
https://github.com/python/cpython/commit/a42fe3c67ca86ac08dc6f47af27eed089d35fdd0
msg318477 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-06-02 00:15
I am leaving this open until the new behavior is documented, even though it might be part of another issue that includes other context changes.

For this issue, I will leave what happens when unzooming unspecific.
msg318974 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-06-07 22:04
Summary for users: Previously, Code Context displayed a fixed number of lines.  Often, many were blank.  Hence the default *numlines* to display was small, 3, to avoid having too many blank lines.  However, 3 is often too small to display the complete context.

Now, Code Context initially displays a single blank line for 'no context', to show that the feature is active.  When the top visible line is part of an indented body, the context used as many non-blank lines as needed, up to a maximum of *maxlines*, which has a default of 15.  Because a new configuration option is used, there should be no interference between user settings for old releases and future releases. 

Initially, context lines are added to an expanded editor window.  When the height of the window has been maximized, perhaps with the zoomheight feature, and when the height of the window has been reset with the mouse, context lines replace normal code text.
msg318982 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-06-07 23:11
New changeset bed523ba03c4525c9c79a6df700284b6c43024b3 by Terry Jan Reedy in branch 'master':
bpo-33642 and bpo-33679: Revise and condense blurbs (GH-7500)
https://github.com/python/cpython/commit/bed523ba03c4525c9c79a6df700284b6c43024b3
msg318986 - (view) Author: miss-islington (miss-islington) Date: 2018-06-07 23:30
New changeset ab5da50d82766acb49ba162dd61b0f8f19424e29 by Miss Islington (bot) in branch '3.7':
bpo-33642 and bpo-33679: Revise and condense blurbs (GH-7500)
https://github.com/python/cpython/commit/ab5da50d82766acb49ba162dd61b0f8f19424e29
msg318989 - (view) Author: miss-islington (miss-islington) Date: 2018-06-07 23:34
New changeset d071ab12c85636cd15c8ef33647dad9db8441afb by Miss Islington (bot) in branch '3.6':
bpo-33642 and bpo-33679: Revise and condense blurbs (GH-7500)
https://github.com/python/cpython/commit/d071ab12c85636cd15c8ef33647dad9db8441afb
History
Date User Action Args
2022-04-11 14:59:00adminsetgithub: 77823
2018-06-08 21:55:04terry.reedysetkeywords: patch, patch
status: open -> closed
resolution: fixed
stage: patch review -> resolved
2018-06-07 23:34:16miss-islingtonsetmessages: + msg318989
2018-06-07 23:30:27miss-islingtonsetmessages: + msg318986
2018-06-07 23:13:52miss-islingtonsetpull_requests: + pull_request7129
2018-06-07 23:12:55miss-islingtonsetpull_requests: + pull_request7127
2018-06-07 23:11:44terry.reedysetmessages: + msg318982
2018-06-07 22:55:31terry.reedysetpull_requests: + pull_request7125
2018-06-07 22:51:50terry.reedysetkeywords: patch, patch
title: IDLE: Use variable number of lines in CodeContext -> IDLE: Display up to maxlines non-blank lines for Code Context
2018-06-07 22:04:44terry.reedysetkeywords: patch, patch

messages: + msg318974
2018-06-02 00:15:17terry.reedysetkeywords: patch, patch

messages: + msg318477
2018-06-02 00:08:08miss-islingtonsetmessages: + msg318475
2018-06-01 23:46:04miss-islingtonsetnosy: + miss-islington
messages: + msg318474
2018-06-01 23:24:11miss-islingtonsetpull_requests: + pull_request6964
2018-06-01 23:23:23miss-islingtonsetpull_requests: + pull_request6963
2018-06-01 23:23:02terry.reedysetmessages: + msg318473
2018-06-01 21:06:29cheryl.sabellasetkeywords: patch, patch

messages: + msg318464
2018-06-01 00:57:05terry.reedysetkeywords: patch, patch

messages: + msg318353
2018-05-28 21:40:31cheryl.sabellasetkeywords: patch, patch

messages: + msg317926
2018-05-28 01:24:27terry.reedysetkeywords: patch, patch

messages: + msg317821
2018-05-27 18:32:27terry.reedysetkeywords: patch, patch

messages: + msg317804
2018-05-27 18:31:48terry.reedysetpull_requests: - pull_request6745
2018-05-25 10:41:45cheryl.sabellasetkeywords: patch, patch

messages: + msg317669
2018-05-25 00:59:50terry.reedysetkeywords: patch, patch

messages: + msg317652
versions: + Python 3.6
2018-05-25 00:47:56cheryl.sabellalinkissue33610 dependencies
2018-05-25 00:47:16cheryl.sabellasetkeywords: + patch
stage: patch review
pull_requests: + pull_request6745
2018-05-25 00:47:16cheryl.sabellasetkeywords: + patch
stage: (no value)
pull_requests: + pull_request6744
2018-05-25 00:41:45cheryl.sabellacreate