1
0
mirror of https://github.com/wting/autojump synced 2026-03-02 03:49:26 +00:00

Fix tab completion.

Closes #228.
This commit is contained in:
William Ting
2013-12-31 10:39:52 -06:00
parent 2c999dca83
commit 8ab23c01c4
2 changed files with 28 additions and 19 deletions

View File

@@ -59,28 +59,30 @@ def first(xs):
return None
def get_tab_needle_and_path(tab_entry, separator):
def get_tab_entry_info(entry, separator):
"""
Given a tab entry in the following format return the needle and path:
Given a tab entry in the following format return needle, index, and path:
[needle]__[index]__[path]
"""
match_needle = re.search(r'(.*?)' + separator, tab_entry)
needle, index, path = None, None, None
match_needle = re.search(r'(.*?)' + separator, entry)
match_index = re.search(separator + r'([0-9]{1})', entry)
match_path = re.search(
separator + r'[0-9]{1}' + separator + r'(.*)',
tab_entry)
entry)
if match_needle:
tab_needle = match_needle.group(1)
else:
tab_needle = None
needle = match_needle.group(1)
if match_index:
index = int(match_index.group(1))
if match_path:
path = match_path.group(1)
else:
path = None
return tab_needle, path
return needle, index, path
def get_pwd():