##// END OF EJS Templates
Use file completer when completable text starts with !
vivainio -
Show More
@@ -357,6 +357,12 b' class IPCompleter(Completer):'
357
357
358 protectables = ' ()[]{}'
358 protectables = ' ()[]{}'
359
359
360 if text.startswith('!'):
361 text = text[1:]
362 text_prefix = '!'
363 else:
364 text_prefix = ''
365
360 def protect_filename(s):
366 def protect_filename(s):
361 return "".join([(ch in protectables and '\\' + ch or ch)
367 return "".join([(ch in protectables and '\\' + ch or ch)
362 for ch in s])
368 for ch in s])
@@ -389,7 +395,7 b' class IPCompleter(Completer):'
389 text = os.path.expanduser(text)
395 text = os.path.expanduser(text)
390
396
391 if text == "":
397 if text == "":
392 return [protect_filename(f) for f in self.glob("*")]
398 return [text_prefix + protect_filename(f) for f in self.glob("*")]
393
399
394 m0 = self.clean_glob(text.replace('\\',''))
400 m0 = self.clean_glob(text.replace('\\',''))
395 if has_protectables:
401 if has_protectables:
@@ -397,7 +403,8 b' class IPCompleter(Completer):'
397 # beginning of filename so that we don't double-write the part
403 # beginning of filename so that we don't double-write the part
398 # of the filename we have so far
404 # of the filename we have so far
399 len_lsplit = len(lsplit)
405 len_lsplit = len(lsplit)
400 matches = [text0 + protect_filename(f[len_lsplit:]) for f in m0]
406 matches = [text_prefix + text0 +
407 protect_filename(f[len_lsplit:]) for f in m0]
401 else:
408 else:
402 if open_quotes:
409 if open_quotes:
403 # if we have a string with an open quote, we don't need to
410 # if we have a string with an open quote, we don't need to
@@ -405,7 +412,8 b' class IPCompleter(Completer):'
405 # would cause bugs when the filesystem call is made).
412 # would cause bugs when the filesystem call is made).
406 matches = m0
413 matches = m0
407 else:
414 else:
408 matches = [protect_filename(f) for f in m0]
415 matches = [text_prefix +
416 protect_filename(f) for f in m0]
409 if len(matches) == 1 and os.path.isdir(matches[0]):
417 if len(matches) == 1 and os.path.isdir(matches[0]):
410 # Takes care of links to directories also. Use '/'
418 # Takes care of links to directories also. Use '/'
411 # explicitly, even under Windows, so that name completions
419 # explicitly, even under Windows, so that name completions
General Comments 0
You need to be logged in to leave comments. Login now