mirror of
https://github.com/nvbn/thefuck.git
synced 2025-02-21 20:38:54 +00:00
fixed accidentally correcting to some directories with short name length
This commit is contained in:
parent
a54c97f624
commit
252859e63a
@ -76,7 +76,8 @@ def get_new_command(command, settings):
|
|||||||
cwd = os.path.split(cwd)[0]
|
cwd = os.path.split(cwd)[0]
|
||||||
continue
|
continue
|
||||||
best_match = min(_get_sub_dirs(cwd), key=lambda x: _dam_lev_dist(directory, x))
|
best_match = min(_get_sub_dirs(cwd), key=lambda x: _dam_lev_dist(directory, x))
|
||||||
if _dam_lev_dist(directory, best_match) > MAX_ALLOWED_STR_DIST:
|
best_dist = _dam_lev_dist(directory, best_match)
|
||||||
|
if best_dist > MAX_ALLOWED_STR_DIST or best_dist >= len(best_match):
|
||||||
return cd_mkdir.get_new_command(command, settings)
|
return cd_mkdir.get_new_command(command, settings)
|
||||||
else:
|
else:
|
||||||
cwd = os.path.join(cwd, best_match)
|
cwd = os.path.join(cwd, best_match)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user