From f82e9d6cf3bc3a12bdfce89bf319d76f79e66efc Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Tue, 22 Apr 2014 18:39:47 +0200 Subject: zsh-completion: only remove next char if / From Kevin: I found a small bug in the zsh completions. Basically when the PASSWORD_STORE_DIR ends in a slash the first character of the result is eaten, making completion essentially useless. (It does this before determining matches). This can be fixed by changing what is line 106 in my version from: _values -C 'passwords' $(find -L "$prefix" \( -name .git -o -name .gpg-id \) -prune -o $@ -print | sed -e "s#${prefix}.##" -e 's#\.gpg##' | sort) to _values -C 'passwords' $(find -L "$prefix" \( -name .git -o -name .gpg-id \) -prune -o $@ -print | sed -e "s#${prefix}/\\?##" -e 's#\.gpg##' | sort) The difference is the first sed regex expression. The original version assumed that the next character was a slash and removed it while the new version only removes it if it is a slash. "s#${prefix}.##" -> "s#${prefix}/\\?##" Signed-off-by: Jason A. Donenfeld Reported-by: Kevin Cox --- src/completion/pass.zsh-completion | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/completion/pass.zsh-completion b/src/completion/pass.zsh-completion index 892d3de..4c7548c 100644 --- a/src/completion/pass.zsh-completion +++ b/src/completion/pass.zsh-completion @@ -1,11 +1,10 @@ #compdef pass #autoload -# Copyright (C) 2012: +# Copyright (C) 2012 - 2014: # Johan Venant # Brian Mattern # Jason A. Donenfeld . -# Santiago Borrazás # All Rights Reserved. # This file is licensed under the GPLv2+. Please see COPYING for more information. @@ -111,7 +110,7 @@ _pass_cmd_show () { _pass_complete_entries_helper () { local IFS=$'\n' local prefix="${PASSWORD_STORE_DIR:-$HOME/.password-store}" - _values -C 'passwords' $(find -L "$prefix" \( -name .git -o -name .gpg-id \) -prune -o $@ -print | sed -e "s#${prefix}.##" -e 's#\.gpg##' | sort) + _values -C 'passwords' $(find -L "$prefix" \( -name .git -o -name .gpg-id \) -prune -o $@ -print | sed -e "s#${prefix}/\\?##" -e 's#\.gpg##' | sort) } _pass_complete_entries_with_subdirs () { -- cgit v1.2.3-59-g8ed1b