*** ORIG/EditorWindow.py 2005-05-05 01:29:35.933000312 -0400 --- EditorWindow.py 2005-05-05 02:12:31.911248903 -0400 *************** class EditorWindow(object): *** 143,148 **** --- 143,149 ---- text.bind("", self.move_at_edge_if_selection(1)) text.bind("<>", self.del_word_left) text.bind("<>", self.del_word_right) + text.bind("<>", self.home_callback) if flist: flist.inversedict[self] = key *************** class EditorWindow(object): *** 259,264 **** --- 260,309 ---- self.flist.new(dirname) return "break" + def home_callback(self, event): + if (event.state & 12) != 0 and event.keysym == "Home": + # state&1==shift, state&4==control, state&8==alt + return # ; fall back to class binding + + if self.text.index("iomark") and \ + self.text.compare("iomark", "<=", "insert lineend") and \ + self.text.compare("insert linestart", "<=", "iomark"): + insertpt = int(self.text.index("iomark").split(".")[1]) + else: + line = self.text.get("insert linestart", "insert lineend") + for insertpt in xrange(len(line)): + if line[insertpt] not in (' ','\t'): + 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 + self.text.tag_remove("sel", "1.0", "end") + else: + if not self.text.index("sel.first"): + self.text.mark_set("anchor","insert") + + first = self.text.index(dest) + last = self.text.index("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" + def set_status_bar(self): self.status_bar = self.MultiStatusBar(self.top) self.status_bar.set_label('column', 'Col: ?', side=RIGHT) --- CURRENT/PyShell.py 2005-05-05 01:29:36.000000000 -0400 +++ PyShell.py 2005-05-05 02:32:37.000000000 -0400 @@ -806,7 +806,6 @@ text.bind("<>", self.enter_callback) text.bind("<>", self.linefeed_callback) text.bind("<>", self.cancel_callback) - text.bind("<>", self.home_callback) text.bind("<>", self.eof_callback) text.bind("<>", self.open_stack_viewer) text.bind("<>", self.toggle_debugger) @@ -1043,16 +1042,6 @@ self.top.quit() return "break" - def home_callback(self, event): - if event.state != 0 and event.keysym == "Home": - return # ; fall back to class binding - if self.text.compare("iomark", "<=", "insert") and \ - self.text.compare("insert linestart", "<=", "iomark"): - self.text.mark_set("insert", "iomark") - self.text.tag_remove("sel", "1.0", "end") - self.text.see("insert") - return "break" - def linefeed_callback(self, event): # Insert a linefeed without entering anything (still autoindented) if self.reading: