Skip to content

Commit

Permalink
Also expand a leading tilde username prefix.
Browse files Browse the repository at this point in the history
  • Loading branch information
gijsbers committed Jun 2, 2024
1 parent 0373b9d commit 970fc92
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/yinputline.cc
Original file line number Diff line number Diff line change
Expand Up @@ -708,8 +708,18 @@ void YInputLine::autoScroll(int delta, const XMotionEvent *motion) {
}

void YInputLine::complete() {
csmart res;
mstring mstr(fText);
if (mstr[0] == '~' && mstr.length() > 1
&& mstr.lastIndexOf(' ') == -1
&& mstr.lastIndexOf('/') == -1) {
mstring var = mstr.substring(1);
mstring exp = completeUsername(var);
if (exp != var) {
setText(mstr.substring(0, 1) + exp, false);
return;
}
}
csmart res;
int res_count = globit_best(mstr, &res, nullptr, nullptr);
// directory is not a final match
if (res_count == 1 && upath(res).dirExists())
Expand Down

0 comments on commit 970fc92

Please sign in to comment.