mirror of
https://github.com/wting/autojump
synced 2024-10-27 20:34:07 +00:00
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.
This commit is contained in:
parent
6a529f4f92
commit
8171528215
@ -210,6 +210,9 @@ def handle_tab_completion(needle, entries):
|
|||||||
if tab_path:
|
if tab_path:
|
||||||
print_local(tab_path)
|
print_local(tab_path)
|
||||||
elif tab_index:
|
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
|
get_ith_path = lambda i, iterable: last(take(i, iterable)).path
|
||||||
print_local(get_ith_path(
|
print_local(get_ith_path(
|
||||||
tab_index,
|
tab_index,
|
||||||
|
Loading…
Reference in New Issue
Block a user