From 53d894e7a368c782abbab56dc7f5048851a69138 Mon Sep 17 00:00:00 2001 From: Paul Ackersviller Date: Mon, 26 Nov 2007 03:41:21 +0000 Subject: Merge of Mikael Magnusson: 24076, 24081, 24082: need to cancel option processing with -- after widget calls with arguments. --- Functions/Zle/kill-word-match | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 Functions/Zle/kill-word-match (limited to 'Functions/Zle/kill-word-match') diff --git a/Functions/Zle/kill-word-match b/Functions/Zle/kill-word-match new file mode 100644 index 000000000..5fcaeb86c --- /dev/null +++ b/Functions/Zle/kill-word-match @@ -0,0 +1,34 @@ +emulate -L zsh +setopt extendedglob + +autoload match-words-by-style + +local curcontext=":zle:$WIDGET" word done +local -a matched_words +integer count=${NUMERIC:-1} + +if (( count < 0 )); then + (( NUMERIC = -count )) + zle backward-$WIDGET + return +fi + +while (( count-- )); do + match-words-by-style + + word="${(j..)matched_words[4,5]}" + + if [[ -n $word ]]; then + if [[ -n $done || $LASTWIDGET = *kill* ]]; then + CUTBUFFER="$CUTBUFFER$word" + else + zle copy-region-as-kill -- $word + fi + RBUFFER=${(j..)matched_words[6,7]} + else + return 1 + fi + done=1 +done + +return 0 -- cgit 1.4.1