##// END OF EJS Templates
Fix file completion of commands with spaces in them.
Fernando Perez -
Show More
@@ -432,13 +432,12 b' class IPCompleter(Completer):'
432 current (as of Python 2.3) Python readline it's possible to do
432 current (as of Python 2.3) Python readline it's possible to do
433 better."""
433 better."""
434
434
435 #print 'Completer->file_matches: <%s>' % text # dbg
435 #io.rprint('Completer->file_matches: <%s>' % text) # dbg
436
436
437 # chars that require escaping with backslash - i.e. chars
437 # chars that require escaping with backslash - i.e. chars
438 # that readline treats incorrectly as delimiters, but we
438 # that readline treats incorrectly as delimiters, but we
439 # don't want to treat as delimiters in filename matching
439 # don't want to treat as delimiters in filename matching
440 # when escaped with backslash
440 # when escaped with backslash
441
442 if text.startswith('!'):
441 if text.startswith('!'):
443 text = text[1:]
442 text = text[1:]
444 text_prefix = '!'
443 text_prefix = '!'
@@ -463,7 +462,7 b' class IPCompleter(Completer):'
463 # tab pressed on empty line
462 # tab pressed on empty line
464 lsplit = ""
463 lsplit = ""
465
464
466 if lsplit != protect_filename(lsplit):
465 if not open_quotes and lsplit != protect_filename(lsplit):
467 # if protectables are found, do matching on the whole escaped
466 # if protectables are found, do matching on the whole escaped
468 # name
467 # name
469 has_protectables = 1
468 has_protectables = 1
@@ -493,8 +492,7 b' class IPCompleter(Completer):'
493 matches = [text_prefix +
492 matches = [text_prefix +
494 protect_filename(f) for f in m0]
493 protect_filename(f) for f in m0]
495
494
496 #print 'mm',matches # dbg
495 #io.rprint('mm', matches) # dbg
497 #return single_dir_expand(matches)
498 return mark_dirs(matches)
496 return mark_dirs(matches)
499
497
500 def magic_matches(self, text):
498 def magic_matches(self, text):
@@ -689,7 +687,7 b' class IPCompleter(Completer):'
689 Index of the cursor in the full line buffer. Should be provided by
687 Index of the cursor in the full line buffer. Should be provided by
690 remote frontends where kernel has no access to frontend state.
688 remote frontends where kernel has no access to frontend state.
691 """
689 """
692 #io.rprint('COMP1 %r %r %r' % (text, line_buffer, cursor_pos)) # dbg
690 #io.rprint('\nCOMP1 %r %r %r' % (text, line_buffer, cursor_pos)) # dbg
693
691
694 # if the cursor position isn't given, the only sane assumption we can
692 # if the cursor position isn't given, the only sane assumption we can
695 # make is that it's at the end of the line (the common case)
693 # make is that it's at the end of the line (the common case)
@@ -707,8 +705,7 b' class IPCompleter(Completer):'
707 magic_escape = self.magic_escape
705 magic_escape = self.magic_escape
708 self.full_lbuf = line_buffer
706 self.full_lbuf = line_buffer
709 self.lbuf = self.full_lbuf[:cursor_pos]
707 self.lbuf = self.full_lbuf[:cursor_pos]
710
708 #io.rprint('\nCOMP2 %r %r %r' % (text, line_buffer, cursor_pos)) # dbg
711 #io.rprint('COMP2 %r %r %r' % (text, line_buffer, cursor_pos)) # dbg
712
709
713 # Start with a clean slate of completions
710 # Start with a clean slate of completions
714 self.matches[:] = []
711 self.matches[:] = []
General Comments 0
You need to be logged in to leave comments. Login now