Fix a offset by 1 error

For a concrete example, when I used the autojump tool, I often saw this off-by-1 error:
$ j data__
data__1__/Users/ye_wang/data/src/test
data__2__/Users/ye_wang/dataeng/src
data__3__/Users/ye_wang/dataeng/java/com
$ j data__2
/Users/ye_wang/dataeng/java/com

This PR fixes the above issue.
pull/515/head
Ye 7 years ago committed by GitHub
parent 6a529f4f92
commit 8171528215
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -210,6 +210,9 @@ def handle_tab_completion(needle, entries):
if tab_path:
print_local(tab_path)
elif tab_index:
# As our display menu shows the starting index from 1, we want to reduce the user-input
# index by 1.
tab_index = max(0, tab_index - 1)
get_ith_path = lambda i, iterable: last(take(i, iterable)).path
print_local(get_ith_path(
tab_index,

Loading…
Cancel
Save