From 0e8aca60d32861e93c2cef59d658a692786da290 Mon Sep 17 00:00:00 2001 From: Marlon Richert Date: Tue, 26 Oct 2021 16:17:08 +0300 Subject: [PATCH] Escape glob chars in `histfindnodups` mode Fixes #362. --- functions/completion/_autocomplete.history_lines | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/functions/completion/_autocomplete.history_lines b/functions/completion/_autocomplete.history_lines index a3ee6359..820e2e51 100644 --- a/functions/completion/_autocomplete.history_lines +++ b/functions/completion/_autocomplete.history_lines @@ -22,7 +22,8 @@ _autocomplete.history_lines() { fi if [[ -o histfindnodups ]]; then while (( $#events[@] < max_lines && 0 < histno && histno < HISTNO )); do - [[ -v history[$histno] && ! -v events[$history[$histno]] ]] && + # -v's arg is a literal string, so we need to escape glob chars. + [[ -v history[$histno] && ! -v events[${(b)history[$histno]}] ]] && events[$history[$histno]]=$histno (( histno += inc )) done