mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-10-20 20:22:10 +00:00
Merge branch 'fix-symlink-dir-completion' of https://github.com/devangpratap/kitty
This commit is contained in:
commit
2d6d47a3f8
2 changed files with 9 additions and 1 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue