[Idle-dev] The '>>> ' prompt is bad

Roger Serwy roger.serwy at gmail.com
Thu Jun 21 03:16:30 CEST 2012


On 06/20/2012 06:51 PM, Alan Gauld wrote:
> On 17/06/12 02:12, Terry Reedy wrote:
>
>> That is exactly what I mean. The first four *fixed width* characters are
>> off limits to the user.
>
> OK, I see what you mean now. And that's a by-product of the DOS box 
> only allowing mono-spaced fonts (I think, its been a while since I 
> used Windows DOS boxes!)
>
>>>> >>> and consequently the first indent may not look like an indent.
>>>> Indeed, with Lucida Sans Unicode, '...     ' is *shorter* than '>>> ',
>>>> so that the first indent is visually a dedent! This is not acceptible.
>>>
>>> But better than the current situation with no secondary prompt - at
>>> least you can see that there is some kind of indent wrt the prompt.
>>
>> I consider having the first indented line start to the *left* of the
>> unindented line above to be worse than the current situation.
>
> But that is the current situation in IDLE? With no secondary prompt 
> the first indented line often starts to the left of the unindented 
> line above.
>
Tkinter's Text widget allows for separate font configuration based on 
tags, meaning that the ps1 and ps2 prompts can be tagged with 
fixed-width fonts, while the rest of the window may contain 
variable-width fonts.

The IPython's Qt Console has Qt's text widget equivalent and extra code 
to make sure that the ps1 and ps2 prompts don't get modified. Adding the 
ps2 prompt should be "simple." The ModifiedUndoDelegator in PyShell.py 
can be modified to prevent changes to prompt tags, as well as handle 
multi-line pasting of code (filling in the ps2 prompts as needed). The 
"runit" method in PyShell.py  would need to be modified to remove and 
ps2 text from "line".

I could write a patch to allow ps2 prompts if there's any serious interest.

- Roger


More information about the IDLE-dev mailing list