Skip to content

Commit

Permalink
Also do tilde expansion in file arguments.
Browse files Browse the repository at this point in the history
  • Loading branch information
gijsbers committed May 16, 2024
1 parent afc1442 commit ebb8358
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/upath.cc
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ bool upath::glob(mstring pattern, YStringArray& list, const char* flags) {
case 'C': flagbits |= GLOB_NOCHECK; break;
case 'E': flagbits |= GLOB_NOESCAPE; break;
case 'S': flagbits |= GLOB_NOSORT; break;
case 'T': flagbits |= GLOB_TILDE; break;
default: break;
}
}
Expand Down
7 changes: 6 additions & 1 deletion src/yinputline.cc
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,12 @@ void YInputLine::complete() {
if (i > 0 && size_t(i + 1) < mstr.length()) {
mstring sub(mstr.substring(i + 1));
YStringArray list;
if (upath::glob(sub + "*", list, "/S") && list.nonempty()) {
if (sub[0] == '~' && upath::glob(sub, list, "/ST") &&
list.getCount() == 1) {
mstring found(mstr.substring(0, i + 1) + list[0]);
setText(found, true);
}
else if (upath::glob(sub + "*", list, "/S") && list.nonempty()) {
if (list.getCount() == 1) {
mstring found(mstr.substring(0, i + 1) + list[0]);
setText(found, true);
Expand Down

0 comments on commit ebb8358

Please sign in to comment.