[Idle-dev] Bug in cursor placement in IDLE editor windows

Irv Kalb Irv at furrypants.com
Fri Nov 3 00:49:20 EDT 2017


Hi Terry,

Thanks for your message.  
> On Nov 2, 2017, at 5:24 PM, Terry Reedy <tjreedy at udel.edu> wrote:
> 
> On 11/2/2017 7:20 PM, Irv Kalb wrote:
> 
>> I use IDLE when teaching classes, and I use it to develop small programs for my lessons.  I have found a bug that has been in IDLE for a while, and I finally got frustrated enough with it to write.
>> I am running on a Mac using IDLE version 3.6.1:
>> Python 3.6.1 (v3.6.1:69c0db5050, Mar 21 2017, 01:21:04)
>> [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
> 
> From the date, this appears to be the binary from python.org.

Yes, I am using an absolutely standard download from python.org <http://python.org/>.  No modifications at all.

> Did you upgrade tcl/tk as specified at
> https://www.python.org/download/mac/tcltk/ ?

No, I have not.  I had no idea that I needed to do this.  I just took a look at that page, and it does suggest that I need to upgrade. 

> What Tk version is shown by Help => About IDLE?

It says Tk version: 8.5.15

> 
>> running Max OS X 10.12.6 - but I also see this same problem when I am in class running Windows 10, with Python 3.6.???
> I use Windows 10 and I cannot reproduce the problem you report with any of 2.7.14, 3.6.3, or 3.7.0a2.  I used
> if a:
>    if b:
>        if c:
>            d
>            d
>            f
> for testing.  Please post a sample text that fails on Windows 10.  If you want, do what I would do and insert it into the following code.

Unfortunately, I won't be able to do that until next week when I am back at the school.  I will try to remember to do that then.

> 
> import tkinter as tk
> root = tk.Tk()
> text = tk.Text(root)
> sample = '''
> <replace this with sample that allows reported error>
> '''
> text.insert('1.0', sample)
> text.pack()
> root.mainloop()
> 
> Then run and click in the resulting Text window and see if the behavior is the same or different.  Mouse clicks in the text area of an editor window are primarily handled by tk, not IDLE or even tkinter.  Without running this control experiment, there is no reason to blame IDLE.

I just tried your test on my Mac with the following:

import tkinter as tk
root = tk.Tk()
text = tk.Text(root)
sample = '''
if x:
    y = 1
'''
text.insert('1.0', sample)
text.pack()
root.mainloop()

I run it, it brings up a widow with the two lines, and the same problem occurs there.

> 
> > One thing to point out, I always use the Tab key to indent my lines. However, even if I type many space characters to indent, I see the same (incorrect behavior).
> 
> Unless you have a particular undocumented entry in <HOME>/.idlerc/config-main.cfg, tabs are converted to spaces (default 4) before insertion into the text widget.  If the <- and -> arrow keys always move one character, you have spaces.

I have not changed any configuration like this.

> 
>> If I have an indented line, and I click just to the left of the first real character on that line, often IDLE will place the insertion cursor at the wrong place - at one character to the right of the left edge of the window.  If I click in the same spot (Just to the left of the first real character on the line), IDLE responds by moving the insertion cursor one space to the right.  Depending on how many times the line I'm clicking on has been indented, IDLE eventually highlights a section from the last character of the previous line to just before the first real character of the line where I clicked.  If I click one more time, IDLE puts the insertion character in the correct place.
> 
> For me, a sinple click places the the cursor on the nearest between-character slice line, either to the left or right of where I click.  Two clicks that are rapid enough to be interpreted as a double click select a word or non-word slice.  Similarly, clicks with the bar overlapping two lines are pushed to the 'closer' line, either up or down.
> 
> --
> Terry Jan Reedy
> _______________________________________________
> IDLE-dev mailing list
> IDLE-dev at python.org
> https://mail.python.org/mailman/listinfo/idle-dev
> 

Sounds like I need to upgrade TCL.  Following the links on the page you provided, it looks like I need to download ActiveTCL, with the newest version being 8.6.6 from ActiveState.com.

Does that sound right?

How would the average person (who doesn't follow links on forums like this and get expert help from someone like you) know to do this???

Thanks,

Irv



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/idle-dev/attachments/20171102/961ea354/attachment-0001.html>


More information about the IDLE-dev mailing list