Skip to content

Commit

Permalink
escape more chars in pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
nakamuray committed Feb 16, 2011
1 parent e084d20 commit 2f8cffc
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions filter-select
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,8 @@ function filter-select() {

if [[ "${BUFFER}" != "${last_buffer}" ]]; then
if [[ -n "${BUFFER}" ]]; then
pattern="${BUFFER}"
# escape "(" and ")" to avoid crash
pattern="${pattern//\(/\(}"
pattern="${pattern//\)/\)}"
# escape "(", ")", "[", "]" and "#" to avoid crash
pattern="${BUFFER//(#m)[()[\]#]/\\${MATCH}}"

matched_cand_keys=("${(onk@)candidates[(R)*${pattern}*]}")
else
Expand Down

0 comments on commit 2f8cffc

Please sign in to comment.