File tree Expand file tree Collapse file tree 1 file changed +1
-22
lines changed
Expand file tree Collapse file tree 1 file changed +1
-22
lines changed Original file line number Diff line number Diff line change @@ -1461,35 +1461,14 @@ def tab(self):
14611461 if not cw :
14621462 return True
14631463
1464- b = self . strbase (self .matches )
1464+ b = os . path . commonprefix (self .matches )
14651465 if b :
14661466 self .s += b [len (cw ):]
14671467 self .print_line (self .s )
14681468 if len (self .matches ) == 1 and OPTS .auto_display_list :
14691469 self .scr .touchwin ()
14701470 return True
14711471
1472- def strbase (self , l ):
1473- """Probably not the best way of doing it but this function returns
1474- a common base string in a list of strings (for tab completion)."""
1475-
1476- if not l :
1477- return ''
1478- elif len (l ) == 1 :
1479- return l [0 ]
1480-
1481- sl = sorted (l , key = len )
1482- for i , c in enumerate (l [- 1 ]):
1483- # I hate myself. Please email seamusmb@gmail.com to call him a dickhead for
1484- # insisting that I make bpython 2.4-compatible. I couldn't be bothered
1485- # refactoring, so ghetto all() it is:
1486- if not reduce (lambda x , y : (x and y ) or False ,
1487- (k .startswith (l [- 1 ][:i ]) for k in sl ),
1488- True ):
1489- break
1490-
1491- return l [- 1 ][:i - 1 ]
1492-
14931472 def atbol (self ):
14941473 """Return True or False accordingly if the cursor is at the beginning
14951474 of the line (whitespace is ignored). This exists so that p_key() knows
You can’t perform that action at this time.
0 commit comments