[issue6143] IDLE - an extension to clear the shell window

Roger Serwy report at bugs.python.org
Wed Feb 12 00:48:03 CET 2014


Roger Serwy added the comment:

>
> Removing text before "iomark" can be done by using the underlying Text widget directly. See how the Squeezer extension does this in issue1529353. This should simplify the implementation significantly.

I agree that the underlying .delete can be called directly, bypassing 
the ModifiedUndoDelegator in the percolator chain. I have mixed opinions 
about the Percolator, but that's another issue.

>
> 1. Is there a reason that text.dump() isn't called inside ClearWindowDeleteCommand.do()?

There is no compelling reason. I agree that it should be moved to .do()

> 2. What is the purpose of strip_ansi()?

That's an artifact from earlier code for IPython compatibility. The 
colored text prompts in IPython use ANSI escape codes, and the older 
undo code reinserted the text without restoring tags.

Using text.dump() and the restore routine in undo() now restore the tags 
and eliminates the need for strip_ansi(). I haven't removed that old 
code yet.

> 3. Does IDLE support multi-line prompts, or is that just IdleX? As a side note, it seems that in IDLE the debugger will override the prompt with '>>> ' whenever it is shut down (see PyShell.close_debugger); perhaps this is a bug?

IDLE itself does support multi-line prompts. The debugger is a whole 
other can of worms.

> 4. I see ClearWindowDeleteCommand just calls text.delete() and text.insert to modify text before the iomark. Will this work on regular IDLE as well, or this is possible only in IdleX?

It should work on regular IDLE. IdleX wraps the existing CPython IDLE.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6143>
_______________________________________


More information about the Python-bugs-list mailing list