]> granicus.if.org Git - python/commitdiff
Bug: clearing the shell undo list after a prompt was allowing files to be
authorKurt B. Kaiser <kbk@shore.net>
Sun, 21 Jul 2002 01:24:28 +0000 (01:24 +0000)
committerKurt B. Kaiser <kbk@shore.net>
Sun, 21 Jul 2002 01:24:28 +0000 (01:24 +0000)
opened on top of the shell instead of in a new window.

Lib/idlelib/IOBinding.py

index eb901dc60e16f8d9c00dc7d54fc8c1fe7d49f9f2..496bc4318325e9f9da08b3c1f897e1b28ed7fbe3 100644 (file)
@@ -87,17 +87,23 @@ class IOBinding:
             else:
                 filename=editFile
             if filename:
-                # if the current window has no filename and hasn't been
-                #   modified, we replace it's contents (no loss).  Otherwise
-                #   we open a new window.
-                if not self.filename and self.get_saved():
+                # If the current window has no filename and hasn't been
+                # modified, we replace its contents (no loss).  Otherwise
+                # we open a new window.  But we won't replace the
+                # shell window (which has an interp(reter) attribute), which
+                # gets set to "not modified" at every new prompt.
+                try:
+                    interp = self.editwin.interp
+                except:
+                    interp = None
+                if not self.filename and self.get_saved() and not interp:
                     self.editwin.flist.open(filename, self.loadfile)
                 else:
                     self.editwin.flist.open(filename)
             else:
                 self.text.focus_set()
-
             return "break"
+        #
         # Code for use outside IDLE:
         if self.get_saved():
             reply = self.maybesave()