summaryrefslogtreecommitdiffstats
path: root/Tools/idle/AutoExpand.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1999-01-02 21:28:54 (GMT)
committerGuido van Rossum <guido@python.org>1999-01-02 21:28:54 (GMT)
commit504b0bf066e4fddb21646331e89c2f6836c5c638 (patch)
treef5454648430eb4818810305325561aabb02cf035 /Tools/idle/AutoExpand.py
parentf07c328c072e62ada8671ec30392572add22d904 (diff)
downloadcpython-504b0bf066e4fddb21646331e89c2f6836c5c638.zip
cpython-504b0bf066e4fddb21646331e89c2f6836c5c638.tar.gz
cpython-504b0bf066e4fddb21646331e89c2f6836c5c638.tar.bz2
Checking in IDLE 0.2.
Much has changed -- too much, in fact, to write down. The big news is that there's a standard way to write IDLE extensions; see extend.txt. Some sample extensions have been provided, and some existing code has been converted to extensions. Probably the biggest new user feature is a new search dialog with more options, search and replace, and even search in files (grep). This is exactly as downloaded from my laptop after returning from the holidays -- it hasn't even been tested on Unix yet.
Diffstat (limited to 'Tools/idle/AutoExpand.py')
-rw-r--r--Tools/idle/AutoExpand.py31
1 files changed, 22 insertions, 9 deletions
diff --git a/Tools/idle/AutoExpand.py b/Tools/idle/AutoExpand.py
index 0d80ce8..1ebd7d5 100644
--- a/Tools/idle/AutoExpand.py
+++ b/Tools/idle/AutoExpand.py
@@ -1,17 +1,30 @@
import string
import re
+###$ event <<expand-word>>
+###$ win <Alt-slash>
+###$ unix <Alt-slash>
+
class AutoExpand:
-
+
+ keydefs = {
+ '<<expand-word>>': ['<Alt-slash>'],
+ }
+
+ menudefs = [
+ ('edit', [
+ ('E_xpand word', '<<expand-word>>'),
+ ]),
+ ]
+
wordchars = string.letters + string.digits + "_"
- def __init__(self, text):
- self.text = text
- self.text.wordlist = None
+ def __init__(self, editwin):
+ self.text = editwin.text
+ self.text.wordlist = None # XXX what is this?
self.state = None
- self.text.bind("<<expand-word>>", self.autoexpand)
-
- def autoexpand(self, event):
+
+ def expand_word_event(self, event):
curinsert = self.text.index("insert")
curline = self.text.get("insert linestart", "insert lineend")
if not self.state:
@@ -36,7 +49,7 @@ class AutoExpand:
curline = self.text.get("insert linestart", "insert lineend")
self.state = words, index, curinsert, curline
return "break"
-
+
def getwords(self):
word = self.getprevword()
if not word:
@@ -66,7 +79,7 @@ class AutoExpand:
dict[w] = w
words.append(word)
return words
-
+
def getprevword(self):
line = self.text.get("insert linestart", "insert")
i = len(line)