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