From e3840d0f9e5ed0d9c16bfb4cd1d9d63198292886 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Sat, 22 Apr 2023 19:24:30 +0300 Subject: [PATCH] docs(_comp_delimited): elaborate on prefix addition considerations --- bash_completion | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bash_completion b/bash_completion index fe56e4eced6..06a3492fe23 100644 --- a/bash_completion +++ b/bash_completion @@ -895,6 +895,13 @@ _comp_delimited() _comp_compgen COMPREPLY "$@" -- "${cur##*"$delimiter"}" fi + # It would seem that in some specific cases we could avoid adding the + # prefix to all completions, thereby making the list of suggestions + # cleaner, and only adding it when there's exactly one completion. + # The cases where this opportunity has been observed involve having + # `show-all-if-ambiguous` on, but even that has cases where it fails + # and the last separator including everything before it is lost. + # https://github.com/scop/bash-completion/pull/913#issuecomment-1490140309 local i for i in "${!COMPREPLY[@]}"; do COMPREPLY[i]="$prefix${COMPREPLY[i]}"