summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Lib/idlelib/EditorWindow.py22
-rw-r--r--Lib/idlelib/NEWS.txt6
-rw-r--r--Lib/idlelib/TODO.txt2
3 files changed, 28 insertions, 2 deletions
diff --git a/Lib/idlelib/EditorWindow.py b/Lib/idlelib/EditorWindow.py
index b9522fc..fcb1612 100644
--- a/Lib/idlelib/EditorWindow.py
+++ b/Lib/idlelib/EditorWindow.py
@@ -132,6 +132,8 @@ class EditorWindow:
text.bind("<<untabify-region>>",self.untabify_region_event)
text.bind("<<toggle-tabs>>",self.toggle_tabs_event)
text.bind("<<change-indentwidth>>",self.change_indentwidth_event)
+ text.bind("<Left>", self.move_at_edge_if_selection(0))
+ text.bind("<Right>", self.move_at_edge_if_selection(1))
if flist:
flist.inversedict[self] = key
@@ -344,6 +346,26 @@ class EditorWindow:
self.text.tag_remove("sel", "1.0", "end")
self.text.see("insert")
+ def move_at_edge_if_selection(self, edge_index):
+ """Cursor move begins at start or end of selection
+
+ When a left/right cursor key is pressed create and return to Tkinter a
+ function which causes a cursor move from the associated edge of the
+ selection.
+
+ """
+ self_text_index = self.text.index
+ self_text_mark_set = self.text.mark_set
+ edges_table = ("sel.first+1c", "sel.last-1c")
+ def move_at_edge(event):
+ if (event.state & 5) == 0: # no shift(==1) or control(==4) pressed
+ try:
+ self_text_index("sel.first")
+ self_text_mark_set("insert", edges_table[edge_index])
+ except TclError:
+ pass
+ return move_at_edge
+
def find_event(self, event):
SearchDialog.find(self.text)
return "break"
diff --git a/Lib/idlelib/NEWS.txt b/Lib/idlelib/NEWS.txt
index f6ed853..07904a3 100644
--- a/Lib/idlelib/NEWS.txt
+++ b/Lib/idlelib/NEWS.txt
@@ -7,6 +7,12 @@ What's New in IDLEfork 0.9 Alpha 2?
*Release date: XX-XXX-2003*
+- Left cursor move in presence of selected text now moves from left end
+ of the selection.
+
+- Add Meta keybindings to "IDLE Classic Windows" to handle reversed
+ Alt/Meta on some Linux distros.
+
- Change default: IDLE now starts with Python Shell.
- Removed the File Path from the Additional Help Sources scrolled list.
diff --git a/Lib/idlelib/TODO.txt b/Lib/idlelib/TODO.txt
index 96b0450..c1207b6 100644
--- a/Lib/idlelib/TODO.txt
+++ b/Lib/idlelib/TODO.txt
@@ -46,8 +46,6 @@ TO DO:
Details:
-- when there's a selection, left/right arrow should go to either
- end of the selection
- ^O (on Unix -- open-line) should honor autoindent
- after paste, show end of pasted text
- on Windows, should turn short filename to long filename (not only in argv!)