Path: csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail From: Luca Boccassi Newsgroups: gnu.bash.bug Subject: [PATCH] Fix custom program's completions when initial word is set Date: Fri, 23 Nov 2018 12:48:54 +0000 Lines: 49 Approved: bug-bash@gnu.org Message-ID: NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-Trace: usenet.stanford.edu 1542977353 24436 208.118.235.17 (23 Nov 2018 12:49:13 GMT) X-Complaints-To: action@cs.stanford.edu Cc: Luca Boccassi To: bug-bash@gnu.org Envelope-to: bug-bash@gnu.org X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=telmV2iSxRvE7gk+k67t64mWysB5X75smA4wu4P9EdE=; b=EBrQbtsxYVZyKJm142RTW3zKcLpkVjjijauloH0Ly4I6oT2btj6uMoMtFLbFejFz5r hX3zx/I0AzR4GabxpQN3ngdEmK178WXuyIseoGoYFfqYga/ZFTZmkN9ypoCXruDzLth/ OxI0JF/XTk75EtygOahbUmObkAeewpFZDhYRdRbLzEcOxWChBFZP0uxolhJIW9dj/Yo8 iC6o40ts2j7a9bJtXOtFU456pxHwU6xoHGnnNqLW1kPrheZf30t7sdwyTehjkOM/nTGA kyXCd5hD7QpWJuc7+inVDgHPuf170BnkT3/rf1YBvFL2mECTt8mFq3kK3avlHaZxLLyr QOhQ== X-Gm-Message-State: AA+aEWbNjVVxGiXFP8BBLvFZjgOSvLFtdwO9cPazD0dOksTjor5dDb5P SOUSccYJbKj77yG491K6cgBWnltc X-Google-Smtp-Source: AFSGD/X/n7hlPdl6qxLU8qo04a1byCcyfKhoNs8o82cLKAXejImaLT3cyIuuwZVXCm3M+03wBUEz8A== X-Received: by 2002:adf:f8d2:: with SMTP id f18mr10596830wrq.265.1542977338627; Fri, 23 Nov 2018 04:48:58 -0800 (PST) X-Mailer: git-send-email 2.19.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.221.43 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com gnu.bash.bug:14843 The change to fix mid-word initial completion inadvertently broke custom command completion. To reproduce: cat > repro< --- Dear Maintainer, noticed this a bit too late after some more testing. This fix appears to work, let me know if you'd like a different solution. Thanks! bashline.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bashline.c b/bashline.c index d56cd79d..f2d17a70 100644 --- a/bashline.c +++ b/bashline.c @@ -1583,7 +1583,7 @@ attempt_shell_completion (text, start, end) /* command completion if programmable completion fails */ /* If we have a completion for the initial word, we can prefer that */ in_command_position = s == start && (iw_compspec || STREQ (n, text)); /* XXX */ - foundcs = foundcs && (iw_compspec == 0); + foundcs = foundcs && (iw_compspec == 0 || in_command_position == 0); } /* empty command name following command separator */ else if (s >= e && n[0] == '\0' && text[0] == '\0' && start > 0 && -- 2.19.1