From bf86a92596d6486fe30acb73d4bea6edda9d3df1 Mon Sep 17 00:00:00 2001 From: Daniel Matz Date: Tue, 24 Nov 2015 20:27:14 -0600 Subject: Fix tab completion after '%' character. --- src/expand.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/expand.cpp') diff --git a/src/expand.cpp b/src/expand.cpp index 5b46bdfa..107f51d3 100644 --- a/src/expand.cpp +++ b/src/expand.cpp @@ -590,8 +590,12 @@ static int find_job(const struct find_job_data_t *info) const job_t *j; int found = 0; - // do the empty param check first, because an empty string passes our 'numeric' check - if (wcslen(proc)==0) + // If we are not doing tab completion, we first check for the single '%' + // character, because an empty string will pass the numeric check below. + // But if we are doing tab completion, we want all of the job IDs as + // completion options, not just the last job backgrounded, so we pass this + // first block in favor of the second. + if (wcslen(proc)==0 && !(flags & EXPAND_FOR_COMPLETIONS)) { /* This is an empty job expansion: '%' -- cgit v1.2.3