[Python-checkins] cpython (merge 2.7 -> 2.7): merge heads

benjamin.peterson python-checkins at python.org
Fri Mar 25 22:56:58 CET 2011


http://hg.python.org/cpython/rev/b1f830ae0d68
changeset:   68939:b1f830ae0d68
branch:      2.7
parent:      68938:5cf8f6da8743
parent:      68937:500e48708470
user:        Benjamin Peterson <benjamin at python.org>
date:        Fri Mar 25 16:58:31 2011 -0500
summary:
  merge heads

files:
  Lib/idlelib/EditorWindow.py |  21 +++++++++------------
  Lib/idlelib/NEWS.txt        |   5 ++++-
  2 files changed, 13 insertions(+), 13 deletions(-)


diff --git a/Lib/idlelib/EditorWindow.py b/Lib/idlelib/EditorWindow.py
--- a/Lib/idlelib/EditorWindow.py
+++ b/Lib/idlelib/EditorWindow.py
@@ -310,10 +310,10 @@
         if (event.state & 4) != 0 and event.keysym == "Home":
             # state&4==Control. If <Control-Home>, use the Tk binding.
             return
-
         if self.text.index("iomark") and \
            self.text.compare("iomark", "<=", "insert lineend") and \
            self.text.compare("insert linestart", "<=", "iomark"):
+            # In Shell on input line, go to just after prompt
             insertpt = int(self.text.index("iomark").split(".")[1])
         else:
             line = self.text.get("insert linestart", "insert lineend")
@@ -322,30 +322,27 @@
                     break
             else:
                 insertpt=len(line)
-
         lineat = int(self.text.index("insert").split('.')[1])
-
         if insertpt == lineat:
             insertpt = 0
-
         dest = "insert linestart+"+str(insertpt)+"c"
-
         if (event.state&1) == 0:
-            # shift not pressed
+            # shift was not pressed
             self.text.tag_remove("sel", "1.0", "end")
         else:
             if not self.text.index("sel.first"):
-                self.text.mark_set("anchor","insert")
-
+                self.text.mark_set("my_anchor", "insert")  # there was no previous selection
+            else:
+                if self.text.compare(self.text.index("sel.first"), "<", self.text.index("insert")):
+                    self.text.mark_set("my_anchor", "sel.first") # extend back
+                else:
+                    self.text.mark_set("my_anchor", "sel.last") # extend forward
             first = self.text.index(dest)
-            last = self.text.index("anchor")
-
+            last = self.text.index("my_anchor")
             if self.text.compare(first,">",last):
                 first,last = last,first
-
             self.text.tag_remove("sel", "1.0", "end")
             self.text.tag_add("sel", first, last)
-
         self.text.mark_set("insert", dest)
         self.text.see("insert")
         return "break"
diff --git a/Lib/idlelib/NEWS.txt b/Lib/idlelib/NEWS.txt
--- a/Lib/idlelib/NEWS.txt
+++ b/Lib/idlelib/NEWS.txt
@@ -3,7 +3,10 @@
 
 *Release date: XX-XX-XXXX*
 
-- <Home> toggle non-functional when NumLock set on Windows.  Issue3851.
+- <Home> toggle failing on Tk 8.5, causing IDLE exits and strange selection
+  behavior. Issue 4676.  Improve selection extension behaviour.
+- <Home> toggle non-functional when NumLock set on Windows.  Issue 3851.
+
 
 What's New in IDLE 2.7?
 =======================

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list