Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #14843 > unrolled thread
| Started by | Luca Boccassi <bluca@debian.org> |
|---|---|
| First post | 2018-11-23 12:48 +0000 |
| Last post | 2018-11-23 12:48 +0000 |
| Articles | 1 — 1 participant |
Back to article view | Back to gnu.bash.bug
[PATCH] Fix custom program's completions when initial word is set Luca Boccassi <bluca@debian.org> - 2018-11-23 12:48 +0000
| From | Luca Boccassi <bluca@debian.org> |
|---|---|
| Date | 2018-11-23 12:48 +0000 |
| Subject | [PATCH] Fix custom program's completions when initial word is set |
| Message-ID | <mailman.4494.1542977352.1284.bug-bash@gnu.org> |
The change to fix mid-word initial completion inadvertently broke custom
command completion.
To reproduce:
cat > repro<<EOF
_repro()
{
echo "completed"
}
EOF
source repro
complete -I -F _repro
git sho
^ tab, nothing happens
This is because if complete -I is set, iw_compspec will always be
non-null and therefore foundcs will always be set to false and bash
will ignore the result of programmable_completions().
The fix is to only override foundcs if both iw_compspec is not null
and we are not in command position.
Signed-off-by: Luca Boccassi <bluca@debian.org>
---
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
Back to top | Article view | gnu.bash.bug
csiph-web