Merge branch 'fix-symlink-dir-completion' of https://github.com/devangpratap/kitty

This commit is contained in:
Kovid Goyal 2026-09-16 08:33:30 +05:30
commit 2d6d47a3f8
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
2 changed files with 9 additions and 1 deletions

View file

@ -320,7 +320,7 @@ func DirectoryCompleter(title string, relative_to relative_to) CompletionFunc {
mg.NoTrailingSpace = true
mg.IsFiles = true
_ = CompleteFiles(word, func(entry *FileEntry) {
if entry.Mode.IsDir() {
if entry.IsDir {
mg.AddMatch(entry.CompletionCandidate)
}
}, cwd)

View file

@ -101,6 +101,14 @@ func TestCompleteFiles(t *testing.T) {
t.Fatalf("Did not get %#v as a completion candidate for prefix: %#v", utils.Sep+name, prefix)
}
}
// symlinks to directories are directories
os.Symlink(filepath.Join(tdir, "odir"), filepath.Join(tdir, "slink"))
c := NewCompletions()
DirectoryCompleter("", CWD)(c, "s", 0)
if len(c.Groups) != 1 || len(c.Groups[0].Matches) != 1 || c.Groups[0].Matches[0].Word != "slink/" {
t.Fatalf("Symlink to directory not completed by DirectoryCompleter: %#v", c.Groups)
}
}
func TestCompleteExecutables(t *testing.T) {