From 6860f7ffd69cfd766f2fec08955d2746a66387a0 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 9 Aug 2022 14:51:14 +0530 Subject: [PATCH] fix zsh serialization of directory candidates ending with / --- kitty/complete.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kitty/complete.py b/kitty/complete.py index 98e9261bd..15eb09b5f 100644 --- a/kitty/complete.py +++ b/kitty/complete.py @@ -277,8 +277,8 @@ def zsh_output_serializer(ans: Completions) -> str: allm = tuple(matches) if len(allm) > 1: common_prefix = os.path.commonprefix(allm) - if common_prefix and '/' in common_prefix: - common_prefix = os.path.dirname(common_prefix) + '/' + if common_prefix and os.sep in common_prefix: + common_prefix = os.path.dirname(common_prefix).rstrip(os.sep) + os.sep cmd.extend(('-p', shlex.quote(common_prefix))) matches = MatchGroup({k[len(common_prefix):]: v for k, v in matches.items()}) has_descriptions = any(matches.values())