PATH:
opt
/
alt
/
python33
/
lib64
/
python3.3
/
idlelib
import string import re ###$ event <<expand-word>> ###$ win <Alt-slash> ###$ unix <Alt-slash> class AutoExpand: menudefs = [ ('edit', [ ('E_xpand Word', '<<expand-word>>'), ]), ] wordchars = string.ascii_letters + string.digits + "_" def __init__(self, editwin): self.text = editwin.text self.state = None def expand_word_event(self, event): curinsert = self.text.index("insert") curline = self.text.get("insert linestart", "insert lineend") if not self.state: words = self.getwords() index = 0 else: words, index, insert, line = self.state if insert != curinsert or line != curline: words = self.getwords() index = 0 if not words: self.text.bell() return "break" word = self.getprevword() self.text.delete("insert - %d chars" % len(word), "insert") newword = words[index] index = (index + 1) % len(words) if index == 0: self.text.bell() # Warn we cycled around self.text.insert("insert", newword) curinsert = self.text.index("insert") 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: return [] before = self.text.get("1.0", "insert wordstart") wbefore = re.findall(r"\b" + word + r"\w+\b", before) del before after = self.text.get("insert wordend", "end") wafter = re.findall(r"\b" + word + r"\w+\b", after) del after if not wbefore and not wafter: return [] words = [] dict = {} # search backwards through words before wbefore.reverse() for w in wbefore: if dict.get(w): continue words.append(w) dict[w] = w # search onwards through words after for w in wafter: if dict.get(w): continue words.append(w) dict[w] = w words.append(word) return words def getprevword(self): line = self.text.get("insert linestart", "insert") i = len(line) while i > 0 and line[i-1] in self.wordchars: i = i-1 return line[i:]
[-] PathBrowser.py
[edit]
[-] MultiStatusBar.py
[edit]
[-] AutoExpand.py
[edit]
[-] CodeContext.py
[edit]
[-] GrepDialog.py
[edit]
[-] configSectionNameDialog.py
[edit]
[-] RemoteObjectBrowser.py
[edit]
[-] CREDITS.txt
[edit]
[-] FileList.py
[edit]
[-] AutoComplete.py
[edit]
[-] EditorWindow.py
[edit]
[+]
idle_test
[-] IdleHistory.py
[edit]
[+]
..
[-] Bindings.py
[edit]
[+]
Icons
[+]
__pycache__
[-] NEWS.txt
[edit]
[-] idle.py
[edit]
[-] tabbedpages.py
[edit]
[-] IOBinding.py
[edit]
[-] ParenMatch.py
[edit]
[-] config-main.def
[edit]
[-] Percolator.py
[edit]
[-] textView.py
[edit]
[-] UndoDelegator.py
[edit]
[-] CallTipWindow.py
[edit]
[-] CallTips.py
[edit]
[-] extend.txt
[edit]
[-] WindowList.py
[edit]
[-] __main__.py
[edit]
[-] config-extensions.def
[edit]
[-] PyShell.py
[edit]
[-] ToolTip.py
[edit]
[-] Debugger.py
[edit]
[-] idlever.py
[edit]
[-] MultiCall.py
[edit]
[-] StackViewer.py
[edit]
[-] ObjectBrowser.py
[edit]
[-] TreeWidget.py
[edit]
[-] idle.pyw
[edit]
[-] run.py
[edit]
[-] dynOptionMenuWidget.py
[edit]
[-] macosxSupport.py
[edit]
[-] configHelpSourceEdit.py
[edit]
[-] PyParse.py
[edit]
[-] WidgetRedirector.py
[edit]
[-] config-keys.def
[edit]
[-] keybindingDialog.py
[edit]
[-] aboutDialog.py
[edit]
[-] OutputWindow.py
[edit]
[-] README.txt
[edit]
[-] configDialog.py
[edit]
[-] RstripExtension.py
[edit]
[-] ScriptBinding.py
[edit]
[-] SearchDialogBase.py
[edit]
[-] ColorDelegator.py
[edit]
[-] FormatParagraph.py
[edit]
[-] HyperParser.py
[edit]
[-] rpc.py
[edit]
[-] ClassBrowser.py
[edit]
[-] help.txt
[edit]
[-] __init__.py
[edit]
[-] HISTORY.txt
[edit]
[-] Delegator.py
[edit]
[-] TODO.txt
[edit]
[-] RemoteDebugger.py
[edit]
[-] ScrolledList.py
[edit]
[-] ReplaceDialog.py
[edit]
[-] ZoomHeight.py
[edit]
[-] config-highlight.def
[edit]
[-] ChangeLog
[edit]
[-] SearchDialog.py
[edit]
[-] AutoCompleteWindow.py
[edit]
[-] configHandler.py
[edit]
[-] SearchEngine.py
[edit]