From 6d86d9185af112cab2561c6e38c599bb5767f97f Mon Sep 17 00:00:00 2001 From: Marc Khouzam Date: Wed, 17 Feb 2021 20:57:45 -0500 Subject: [PATCH] Only consider matching completions for formatting Signed-off-by: Marc Khouzam --- bash_completionsV2.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bash_completionsV2.go b/bash_completionsV2.go index 1f17a641..8859b57c 100644 --- a/bash_completionsV2.go +++ b/bash_completionsV2.go @@ -154,6 +154,8 @@ __%[1]s_handle_standard_completion_case() { while IFS='' read -r comp; do # Strip any description before checking the length comp=${comp%%%%$tab*} + # Only consider the completions that match + comp=$(compgen -W "$comp" -- "$cur") if ((${#comp}>longest)); then longest=${#comp} fi