mirror of
https://github.com/python/cpython.git
synced 2025-08-03 08:34:29 +00:00
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.
This commit is contained in:
parent
f07c328c07
commit
504b0bf066
38 changed files with 2204 additions and 899 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue