From 4279d6514d787d9e42bb7c602d034161e0bfaec7 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 15 Sep 2020 09:22:24 +0530 Subject: [PATCH] Fix path completion for ~ paths --- kittens/tui/path_completer.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/kittens/tui/path_completer.py b/kittens/tui/path_completer.py index 776c59ac4..969bc6f87 100644 --- a/kittens/tui/path_completer.py +++ b/kittens/tui/path_completer.py @@ -35,6 +35,15 @@ def expand_path(path: str) -> str: def find_completions(path: str) -> Generator[str, None, None]: + if path and path[0] == '~': + if path == '~': + yield '~' + os.sep + return + if os.sep not in path: + qpath = os.path.expanduser(path) + if qpath != path: + yield path + os.sep + return qpath = expand_path(path) if not path or path.endswith(os.sep): yield from directory_completions(path, qpath)