[Idle-dev] First line and cursor not visible when opening a file.

Tal Einat taleinat at gmail.com
Sun Jul 17 17:33:14 CEST 2011


On Sun, Jul 17, 2011 at 2:20 AM, Simon Forman <forman.simon at gmail.com> wrote:
> On Thu, Jul 14, 2011 at 3:13 PM, Simon Forman <forman.simon at gmail.com> wrote:
>> I apologize if this is old news. I searched the Python bug tracker and
>> idle-dev list without finding any mention,
>>
>> I'm using IDLE 2.6.5 on Ubuntu 10.04.
>>
>> When I open a file that is longer than the edit window the first line
>> (containing the cursor) is above the top of the edit window.  Put
>> another way, the file opens with the second line at the top of the
>> window rather than the first, giving the impression that the file
>> starts at the second line, and that the cursor is absent.
>>
>> I figured I'd ask about it here before filing a bug.
>>
>> Can anyone shed any light on this behavior?
>>
>> Warm regards,
>> ~Simon
>
> I took a look in the code but I couldn't figure out where or why this
> was happening. I managed to "fix" it by adding the following to the
> end of the EditorWindow __init__ method:
>
>        text.see('insert')
>
> Is this worth a bug report and patch?

Hi Simon,

EditorWindow.__init__() already calls io.loadfile() when opening a
file, which includes the following near the end:

self.text.mark_set("insert", "1.0")
self.text.see("insert")

However, EditorWindow.__init__() also does a few more things
afterwards. The only thing that I can think of right now that would
have such an effect is the CodeContext extension, which is loaded by
the self.load_extensions() call after io.loadfile(). Could you try
disabling this extension (in the config file) and see if this has an
effect?

- Tal Einat


More information about the IDLE-dev mailing list