1
0
mirror of https://github.com/wting/autojump synced 2024-10-27 20:34:07 +00:00

simplify tab completion

This commit is contained in:
William Ting 2013-05-14 21:58:43 -05:00
parent 78e0bb2880
commit 400cd62613

View File

@ -467,13 +467,16 @@ def main():
patterns = [unico('')] patterns = [unico('')]
# check for tab completion # check for tab completion
tab_choice = -1 tab_choice = None
tab_match = re.search(config['separator']+"([0-9]+)", patterns[-1]) tab_match = re.search(sep+'([0-9]+)', patterns[-1])
if tab_match: # user has selected a tab completion entry
# user has selected a tab completion entry
if tab_match:
tab_choice = int(tab_match.group(1)) tab_choice = int(tab_match.group(1))
patterns[-1] = re.sub(config['separator']+"[0-9]+.*", "", patterns[-1]) patterns[-1] = re.sub(sep+'[0-9]+.*', '', patterns[-1])
else: # user hasn't selected a tab completion, display choices again # user hasn't selected a tab completion, display choices again
tab_match = re.match("(.*)"+config['separator'], patterns[-1]) else:
tab_match = re.match('(.*)'+sep, patterns[-1])
if tab_match: if tab_match:
patterns[-1] = tab_match.group(1) patterns[-1] = tab_match.group(1)