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.

Author terry.reedy
Recipients GeeTransit, terry.reedy
Date 2019-08-18.21:02:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1566162157.58.0.418538498191.issue37882@roundup.psfhosted.org>
In-reply-to
Content
I am familiar with the feature in Notepad++ on Windows.  But I never use its +- code folding.  IDLE already has two different and, to me, generally better code folding features.

To get an outline view of a file's classes and functions, use File => Module Browser or its shortcut.  One can selectively expand any item with nested class and function definitions.  Such multilevel outline views are not possible with Notepad++, as [+] mean expands completely, not just nested definitions.  I suspect that this is generally true of IDEs with marginal -+.

[Module browser can still be improved, such as by processing the code in an editor buffer instead of on disk, and updating automatically, but that is a different issue.]

One can instead get a dynamic view of nested compound statement headers with Options => Code Context. Look at any file longer than the editor window with nested compound statements, such as idlelib/editor.py.  This feature is impossible with all or nothing -+ collapse.

There may be other use cases, but then we have a major technical problem.  Tk Text widgets do not support code folding.  They have no method to hide lines in their text buffers.  Nor, as far as I know, is there any workaround with a 'Hide' tag.  Tk fonts have no 'visible' option.  Font size 1 or -1 is not 0, and size 0 is interpreted as a some default, around 15.

So hidden lines would have to be deleted.  The easiest option might be a dictionary mapping tk line numbers to lists of deleted lines and another function and data structure to map tk line numbers to the line numbers needed for display. Doing this without introducing bugs would be non-trivial.

I would not consider this unless there were a strong use case that would greatly benefit *and* be used by beginners.

Silent Ghost> This is an IDLE issue.  If this were added, which is extremely unlikely, it would be backported, just as line numbers were.  (See PEP 434.) It does not really matter which versions are marked here by the OP.
History
Date User Action Args
2019-08-18 21:02:37terry.reedysetrecipients: + terry.reedy, GeeTransit
2019-08-18 21:02:37terry.reedysetmessageid: <1566162157.58.0.418538498191.issue37882@roundup.psfhosted.org>
2019-08-18 21:02:37terry.reedylinkissue37882 messages
2019-08-18 21:02:37terry.reedycreate