From fba70c637f47b1e43ed21e37f65ee4750f71b320 Mon Sep 17 00:00:00 2001 From: toonn Date: Fri, 27 Dec 2019 19:06:20 +0100 Subject: Fix fuzzy tab completion when prefix is valid dir Fuzzy tab completion was dropping the entire valid prefix instead of showing the path relative to the current directory. ``` / $ cd usr/sh / $ cd share/ # `usr/` is dropped because it's already a valid # directory. / $ cd usr/share/ # Proper result with the fix. ``` Fixes #1792 --- ranger/config/commands.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ranger/config/commands.py b/ranger/config/commands.py index 06d5abb7..c2a02b67 100755 --- a/ranger/config/commands.py +++ b/ranger/config/commands.py @@ -243,8 +243,9 @@ class cd(Command): paths = self._tab_fuzzy_match(basepath, tokens) if not os.path.isabs(dest): - paths_rel = basepath - paths = [os.path.relpath(path, paths_rel) for path in paths] + paths_rel = self.fm.thisdir.path + paths = [os.path.relpath(os.path.join(basepath, path), paths_rel) + for path in paths] else: paths_rel = '' return paths, paths_rel -- cgit 1.4.1-2-gfad0