From 1d317dcd1a7a1c1bf84ac52be15732516d067a30 Mon Sep 17 00:00:00 2001 From: William Ting Date: Sun, 9 Mar 2014 19:13:00 -0700 Subject: [PATCH] Remove default '.' path from find_match. This interferes with tab completion. Rather than add another behavior flag to find_matches(), the calling location will add the default path. Closes #245. --- bin/autojump | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/bin/autojump b/bin/autojump index d78d8c4..6eca0cc 100755 --- a/bin/autojump +++ b/bin/autojump @@ -190,10 +190,7 @@ def find_matches(entries, needles, check_entries=True): chain( match_consecutive(needles, data, ignore_case), match_fuzzy(needles, data, ignore_case), - match_anywhere(needles, data, ignore_case), - # default return value so calling shell functions have an - # argument to `cd` to - [Entry('.', 0)])) + match_anywhere(needles, data, ignore_case))) def handle_tab_completion(needle, entries): @@ -399,9 +396,16 @@ def main(args): # noqa elif tab_index: get_ith_path = lambda i, iterable: last(take(i, iterable)).path print_local( - get_ith_path(tab_index, find_matches(entries, tab_needle))) + get_ith_path( + tab_index, + find_matches(entries, tab_needle))) else: - print_local(first(find_matches(entries, needles)).path) + print_local( + first( + chain( + find_matches(entries, needles), + # always return an argument to calling shell functions + [Entry('.', 0)])).path) return 0