>From f096da9756ed4d0cd8a6ef5cee02c67377891439 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 25 Nov 2018 22:43:07 +1300 Subject: [PATCH] Corrections for initial word completion logic 5.0-beta2 includes a correction for the new -I option to the `complete` builtin: However, some custom command completion was broken by this due to an incomplete check for the exceptional midword condition, for which a fix was offered here: This patch adjusts the latter fix by preventing coercion of a value of foundcs that happens to be *greater* than 1 for this block, which also fixes default completion with -D. --- bashline.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bashline.c b/bashline.c index d56cd79d..b3592e31 100644 --- a/bashline.c +++ b/bashline.c @@ -1583,7 +1583,8 @@ 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); + if (iw_compspec && in_command_position) + foundcs = 0; } /* empty command name following command separator */ else if (s >= e && n[0] == '\0' && text[0] == '\0' && start > 0 && -- 2.19.2