fix bug in ~ completion

Fix bug introduced by commit c114cbc9a that causes only the first match
for a ~ completion to be available for selection.

Fixes #4075

(cherry picked from commit eff2a3c3a3)
This commit is contained in:
Kurtis Rader 2017-05-27 16:29:24 -07:00
parent 8ed63d63a4
commit 1c06067d0d

View File

@ -1207,14 +1207,12 @@ bool completer_t::try_complete_user(const wcstring &str) {
wcstring desc = format_string(COMPLETE_USER_DESC, pw_name);
append_completion(&this->completions, &pw_name[name_len], desc, COMPLETE_NO_SPACE);
result = true;
break;
} else if (wcsncasecmp(user_name, pw_name, name_len) == 0) {
wcstring name = format_string(L"~%ls", pw_name);
wcstring desc = format_string(COMPLETE_USER_DESC, pw_name);
append_completion(&this->completions, name, desc,
COMPLETE_REPLACES_TOKEN | COMPLETE_DONT_ESCAPE | COMPLETE_NO_SPACE);
result = true;
break;
}
// If we've spent too much time (more than 200 ms) doing this give up.