From e1ded5cd9480aa9921a8cb0f646b6b569ac1b9d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Tue, 17 May 2022 20:47:47 +0300 Subject: [PATCH] fix(bash-v2): skip empty completions when filtering descriptions (#1691) `read` gives a last null value following a trailing newline. Regression from fb8031162c2ffab270774f13c6904bb04cbba5a7. --- bash_completionsV2.go | 1 + 1 file changed, 1 insertion(+) diff --git a/bash_completionsV2.go b/bash_completionsV2.go index 5e558a5..97202f1 100644 --- a/bash_completionsV2.go +++ b/bash_completionsV2.go @@ -188,6 +188,7 @@ __%[1]s_handle_standard_completion_case() { local compline # Look for the longest completion so that we can format things nicely while IFS='' read -r compline; do + [[ -z $compline ]] && continue # Strip any description before checking the length comp=${compline%%%%$tab*} # Only consider the completions that match