From 3069dbb8ec9c287c2ff6b3a1c8bfde83af81c11b Mon Sep 17 00:00:00 2001
From: "Kurt B. Kaiser" <kbk@shore.net>
Date: Fri, 28 Jan 2005 00:16:16 +0000
Subject: Add keybindings for del-word-left and del-word-right.

M EditorWindow.py
M NEWS.txt
M config-keys.def
M configHandler.py
---
 Lib/idlelib/EditorWindow.py  | 10 ++++++++++
 Lib/idlelib/NEWS.txt         |  9 ++++++++-
 Lib/idlelib/config-keys.def  |  6 ++++++
 Lib/idlelib/configHandler.py |  4 +++-
 4 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/Lib/idlelib/EditorWindow.py b/Lib/idlelib/EditorWindow.py
index 0f14662..31f400c 100644
--- a/Lib/idlelib/EditorWindow.py
+++ b/Lib/idlelib/EditorWindow.py
@@ -141,6 +141,8 @@ class EditorWindow(object):
         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))
+        text.bind("<<del-word-left>>", self.del_word_left)
+        text.bind("<<del-word-right>>", self.del_word_right)
 
         if flist:
             flist.inversedict[self] = key
@@ -386,6 +388,14 @@ class EditorWindow(object):
                     pass
         return move_at_edge
 
+    def del_word_left(self, event):
+        self.text.event_generate('<Meta-Delete>')
+        return "break"
+
+    def del_word_right(self, event):
+        self.text.event_generate('<Meta-d>')
+        return "break"
+
     def find_event(self, event):
         SearchDialog.find(self.text)
         return "break"
diff --git a/Lib/idlelib/NEWS.txt b/Lib/idlelib/NEWS.txt
index 1f64ee9..fd01d33 100644
--- a/Lib/idlelib/NEWS.txt
+++ b/Lib/idlelib/NEWS.txt
@@ -3,17 +3,24 @@ What's New in IDLE 1.2a0?
 
 *Release date: XX-XXX-2005*
 
+- Add keybindings for del-word-left and del-word-right.
+
 - Discourage using an indent width other than 8 when using tabs to indent
   Python code.
 
 - Restore use of EditorWindow.set_indentation_params(), was dead code since
-  Autoindent was merged into EditorWindow.
+  Autoindent was merged into EditorWindow.  This allows IDLE to conform to the
+  indentation width of a loaded file.  (But it still will not switch to tabs
+  even if the file uses tabs.)  Any change in indent width is local to that
+  window.
 
 - Add Tabnanny check before Run/F5, not just when Checking module.
 
 - If an extension can't be loaded, print warning and skip it instead of
   erroring out.
 
+- Improve error handling when .idlerc can't be created (warn and exit).
+
 - The GUI was hanging if the shell window was closed while a raw_input() 
   was pending.  Restored the quit() of the readline() mainloop().
   http://mail.python.org/pipermail/idle-dev/2004-December/002307.html
diff --git a/Lib/idlelib/config-keys.def b/Lib/idlelib/config-keys.def
index 05b0cf4..0653746 100644
--- a/Lib/idlelib/config-keys.def
+++ b/Lib/idlelib/config-keys.def
@@ -55,6 +55,8 @@ tabify-region=<Alt-Key-5> <Meta-Key-5>
 untabify-region=<Alt-Key-6> <Meta-Key-6>
 toggle-tabs=<Alt-Key-t> <Meta-Key-t> <Alt-Key-T>
 change-indentwidth=<Alt-Key-u> <Meta-Key-u> <Alt-Key-U>
+del-word-left=<Control-Key-BackSpace>
+del-word-right=<Control-Key-Delete>
 
 [IDLE Classic Unix]
 copy=<Alt-Key-w> <Meta-Key-w>
@@ -104,6 +106,8 @@ tabify-region=<Alt-Key-5>
 untabify-region=<Alt-Key-6>
 toggle-tabs=<Alt-Key-t>
 change-indentwidth=<Alt-Key-u>
+del-word-left=<Alt-Key-BackSpace>
+del-word-right=<Alt-Key-d>
 
 [IDLE Classic Mac]
 copy=<Command-Key-c>
@@ -153,3 +157,5 @@ tabify-region=<Control-Key-5>
 untabify-region=<Control-Key-6>
 toggle-tabs=<Control-Key-t>
 change-indentwidth=<Control-Key-u>
+del-word-left=<Control-Key-BackSpace>
+del-word-right=<Control-Key-Delete>
diff --git a/Lib/idlelib/configHandler.py b/Lib/idlelib/configHandler.py
index ea913c7..191a87c 100644
--- a/Lib/idlelib/configHandler.py
+++ b/Lib/idlelib/configHandler.py
@@ -579,7 +579,9 @@ class IdleConf:
             '<<tabify-region>>': ['<Alt-Key-5>'],
             '<<untabify-region>>': ['<Alt-Key-6>'],
             '<<toggle-tabs>>': ['<Alt-Key-t>'],
-            '<<change-indentwidth>>': ['<Alt-Key-u>']
+            '<<change-indentwidth>>': ['<Alt-Key-u>'],
+            '<<del-word-left>>': ['<Control-Key-BackSpace>'],
+            '<<del-word-right>>': ['<Control-Key-Delete>']
             }
         if keySetName:
             for event in keyBindings.keys():
-- 
cgit v0.12

