From dbd1dd4ab61986a49c6d9b53eea3f03fff4a1aec Mon Sep 17 00:00:00 2001 From: Takeshi Banse Date: Sat, 13 Aug 2011 11:31:20 +0900 Subject: [PATCH] introduce _filter-select-buffer-words Signed-off-by: Takeshi Banse --- functions/filter-select | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/functions/filter-select b/functions/filter-select index afa1de4..65a8cd9 100644 --- a/functions/filter-select +++ b/functions/filter-select @@ -316,12 +316,7 @@ function filter-select() { if [[ "${BUFFER}" != "${last_buffer}" ]]; then if [[ -n "${BUFFER}" ]]; then - # split into words using shell's command line parsing, - # unquote the words, remove duplicated, - # escape "(", ")", "[", "]" and "#" to avoid crash - # also escape "|" - words=("${(@)${(@Qu)${(z)BUFFER}}//(#m)[()[\]#\|]/\\${MATCH}}") - + _filter-select-buffer-words pattern="${words[1]}" if (( case_insensitive )); then matched_descs=("${(kv@)descriptions[(R)(#i)*${pattern}*]}") @@ -539,6 +534,15 @@ function _filter-select-reset() { _filter-select-update-bottom-lines } +function _filter-select-buffer-words() { + # split into words using shell's command line parsing, + # unquote the words, remove duplicated, + # escape "(", ")", "[", "]" and "#" to avoid crash + # also escape "|" + local MATCH MBEGIN MEND + words=("${(@)${(@Qu)${(z)BUFFER}}//(#m)[()[\]#\|]/\\${MATCH}}") +} + function _filter-select-init-keybind() { integer fd ret