Terry J. Reedy <tjre...@udel.edu> added the comment:

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.

----------
versions: +Python 3.7, Python 3.8

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue37882>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to