diff options
author | Kurt B. Kaiser <kbk@shore.net> | 2011-03-25 21:48:27 (GMT) |
---|---|---|
committer | Kurt B. Kaiser <kbk@shore.net> | 2011-03-25 21:48:27 (GMT) |
commit | 7548bce0ee08a7eb1c2e88ee88799e5982ca21e9 (patch) | |
tree | 9b5283b33b6b332268743e3eb5ddf4b7046300ca /Lib/idlelib/EditorWindow.py | |
parent | 4664563f3401c3d8644ea66c8e4fe71deddcbb80 (diff) | |
download | cpython-7548bce0ee08a7eb1c2e88ee88799e5982ca21e9.zip cpython-7548bce0ee08a7eb1c2e88ee88799e5982ca21e9.tar.gz cpython-7548bce0ee08a7eb1c2e88ee88799e5982ca21e9.tar.bz2 |
<Home> toggle failing on Tk 8.5, causing IDLE exits. Issue 3851.
Diffstat (limited to 'Lib/idlelib/EditorWindow.py')
-rw-r--r-- | Lib/idlelib/EditorWindow.py | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/Lib/idlelib/EditorWindow.py b/Lib/idlelib/EditorWindow.py index 71b768f..935a39f 100644 --- a/Lib/idlelib/EditorWindow.py +++ b/Lib/idlelib/EditorWindow.py @@ -310,10 +310,10 @@ class EditorWindow(object): 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 @@ class EditorWindow(object): 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" |