diff Lib/idlelib/AutoComplete.py @ 46584:84df082dd216 legacy-trunk

Autocompletion of filenames now support alternate separators, e.g. the '/' char on Windows. Patch 2061 Tal Einat.
author Kurt B. Kaiser <kbk@shore.net>
date Sun, 27 Apr 2008 21:52:19 +0000
parents 01a7e66525c2
children 74c0a78114ae
line wrap: on
line diff
--- a/Lib/idlelib/AutoComplete.py	Sun Apr 27 21:38:05 2008 +0000
+++ b/Lib/idlelib/AutoComplete.py	Sun Apr 27 21:52:19 2008 +0000
@@ -23,6 +23,10 @@
 # These constants represent the two different types of completions
 COMPLETE_ATTRIBUTES, COMPLETE_FILES = range(1, 2+1)
 
+SEPS = os.sep
+if os.altsep:  # e.g. '/' on Windows...
+    SEPS += os.altsep
+
 class AutoComplete:
 
     menudefs = [
@@ -70,7 +74,7 @@
         if lastchar == ".":
             self._open_completions_later(False, False, False,
                                          COMPLETE_ATTRIBUTES)
-        elif lastchar == os.sep:
+        elif lastchar in SEPS:
             self._open_completions_later(False, False, False,
                                          COMPLETE_FILES)
 
@@ -126,7 +130,7 @@
                 i -= 1
             comp_start = curline[i:j]
             j = i
-            while i and curline[i-1] in FILENAME_CHARS+os.sep:
+            while i and curline[i-1] in FILENAME_CHARS + SEPS:
                 i -= 1
             comp_what = curline[i:j]
         elif hp.is_in_code() and (not mode or mode==COMPLETE_ATTRIBUTES):