mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-10-20 12:19:36 +00:00
Merge branch 'fix-case-insensitive-completion-matching' of https://github.com/devangpratap/kitty
This commit is contained in:
commit
50eaaf5d15
2 changed files with 16 additions and 1 deletions
|
|
@ -156,7 +156,7 @@ func fname_based_completer(prefix, cwd string, is_match func(string) bool) []str
|
|||
entries, err := os.ReadDir(entry.Abspath)
|
||||
if err == nil {
|
||||
for _, e := range entries {
|
||||
if is_match(e.Name()) || is_dir_or_symlink_to_dir(e, filepath.Join(entry.Abspath, e.Name())) {
|
||||
if is_match(strings.ToLower(e.Name())) || is_dir_or_symlink_to_dir(e, filepath.Join(entry.Abspath, e.Name())) {
|
||||
ans = append(ans, entry.CompletionCandidate)
|
||||
return
|
||||
}
|
||||
|
|
|
|||
|
|
@ -109,6 +109,21 @@ func TestCompleteFiles(t *testing.T) {
|
|||
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)
|
||||
}
|
||||
|
||||
// filenames inside a directory are matched case-insensitively against patterns
|
||||
os.Mkdir(filepath.Join(tdir, "cdir"), 0700)
|
||||
create("cdir", "B.CONF")
|
||||
c = NewCompletions()
|
||||
FnmatchCompleter("", CWD, "*.conf")(c, "c", 0)
|
||||
found := false
|
||||
for _, g := range c.Groups {
|
||||
for _, m := range g.Matches {
|
||||
found = found || m.Word == "cdir/"
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
t.Fatalf("Directory containing only an uppercase extension match not completed by FnmatchCompleter: %#v", c.Groups)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCompleteExecutables(t *testing.T) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue