]> granicus.if.org Git - python/commitdiff
Issue #14937: Perform auto-completion of filenames in strings even for non-ASCII...
authorMartin v. Löwis <martin@v.loewis.de>
Sun, 3 Jun 2012 09:55:32 +0000 (11:55 +0200)
committerMartin v. Löwis <martin@v.loewis.de>
Sun, 3 Jun 2012 09:55:32 +0000 (11:55 +0200)
Lib/idlelib/AutoComplete.py
Lib/idlelib/AutoCompleteWindow.py
Lib/idlelib/NEWS.txt

index 4e173252d6150dc22e2fbf8ee272551f41ca94c4..1298d9f012e45a6884760381496e9546aaaaf074 100644 (file)
@@ -124,13 +124,20 @@ class AutoComplete:
         curline = self.text.get("insert linestart", "insert")
         i = j = len(curline)
         if hp.is_in_string() and (not mode or mode==COMPLETE_FILES):
+            # Find the beginning of the string
+            # fetch_completions will look at the file system to determine whether the
+            # string value constitutes an actual file name
+            # XXX could consider raw strings here and unescape the string value if it's
+            # not raw.
             self._remove_autocomplete_window()
             mode = COMPLETE_FILES
-            while i and curline[i-1] in FILENAME_CHARS:
+            # Find last separator or string start
+            while i and curline[i-1] not in "'\"" + SEPS:
                 i -= 1
             comp_start = curline[i:j]
             j = i
-            while i and curline[i-1] in FILENAME_CHARS + SEPS:
+            # Find string start
+            while i and curline[i-1] not in "'\"":
                 i -= 1
             comp_what = curline[i:j]
         elif hp.is_in_code() and (not mode or mode==COMPLETE_ATTRIBUTES):
index 1ad8d156c9d721bb2d87088836e8d10f3a042b49..04777460ee3e21cb870691f5fa332e2083ced6c9 100644 (file)
@@ -354,6 +354,15 @@ class AutoCompleteWindow:
             # A modifier key, so ignore
             return
 
+        elif event.char:
+            # Regular character with a non-length-1 keycode
+            self._change_start(self.start + event.char)
+            self.lasttypedstart = self.start
+            self.listbox.select_clear(0, int(self.listbox.curselection()[0]))
+            self.listbox.select_set(self._binary_search(self.start))
+            self._selection_changed()
+            return "break"
+
         else:
             # Unknown event, close the window and let it through.
             self.hide_window()
index a6b06b40e0a71e7e89a7422574cc57241b651c62..334b0c2d97dea0dc9ddec2c798bde3ca6cbb26b2 100644 (file)
@@ -1,3 +1,9 @@
+What's New in IDLE 3.2.4?
+=========================
+
+- Issue #14937: Perform auto-completion of filenames in strings even for
+  non-ASCII filenames.
+
 What's New in IDLE 3.2.3?
 =========================