diff options
author | ridiculousfish <corydoras@ridiculousfish.com> | 2012-08-20 13:09:21 -0700 |
---|---|---|
committer | ridiculousfish <corydoras@ridiculousfish.com> | 2012-08-20 13:09:21 -0700 |
commit | 670e33ab27244a48c90bf2b1abcc215edfe9c0bb (patch) | |
tree | 2ee1d1cb654525c286e3e57cc082481c3fa73f06 /wildcard.cpp | |
parent | 3606664cf7c36d202f0823f4cc3207dda2f3af23 (diff) |
Properly handle empty completions (e.g. tab-complete 'foo' with extant files 'foo' and 'foobar' should offer both)
Fixes issue described in https://github.com/fish-shell/fish-shell/issues/290
Diffstat (limited to 'wildcard.cpp')
-rw-r--r-- | wildcard.cpp | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/wildcard.cpp b/wildcard.cpp index 5a87eeb2..db42fadc 100644 --- a/wildcard.cpp +++ b/wildcard.cpp @@ -250,13 +250,8 @@ static bool wildcard_complete_internal(const wcstring &orig, } - if (! out_completion.empty()) - { - append_completion( out, - out_completion, - out_desc, - flags ); - } + /* Note: out_completion may be empty if the completion really is empty, e.g. tab-completing 'foo' when a file 'foo' exists. */ + append_completion(out, out_completion, out_desc, flags); return true; } @@ -1073,7 +1068,7 @@ int wildcard_expand( const wchar_t *wc, std::set<file_id_t> visited_files; int res = wildcard_expand_internal( wc, base_dir, flags, out, completion_set, visited_files ); - + if( flags & ACCEPT_INCOMPLETE ) { wcstring wc_base; |