diff options
Diffstat (limited to 'Functions/Zle')
-rw-r--r-- | Functions/Zle/bracketed-paste-magic | 44 | ||||
-rw-r--r-- | Functions/Zle/insert-files | 4 | ||||
-rw-r--r-- | Functions/Zle/insert-unicode-char | 4 | ||||
-rw-r--r-- | Functions/Zle/url-quote-magic | 2 |
4 files changed, 24 insertions, 30 deletions
diff --git a/Functions/Zle/bracketed-paste-magic b/Functions/Zle/bracketed-paste-magic index c46f741d5..4baae823e 100644 --- a/Functions/Zle/bracketed-paste-magic +++ b/Functions/Zle/bracketed-paste-magic @@ -145,27 +145,26 @@ bracketed-paste-magic() { done fi - # Save context, create a clean slate for the paste - integer bpm_mark=$MARK bpm_cursor=$CURSOR bpm_region=$REGION_ACTIVE - integer bpm_numeric=${NUMERIC:-1} - local bpm_buffer=$BUFFER - fc -p -a /dev/null 0 0 - BUFFER= - zstyle -a :bracketed-paste-magic inactive-keys bpm_inactive if zstyle -s :bracketed-paste-magic active-widgets bpm_active '|'; then - # There are active widgets. Reprocess $PASTED as keystrokes. - NUMERIC=1 - zle -U - $PASTED - + # Save context, create a clean slate for the paste + integer bpm_mark=$MARK bpm_region=$REGION_ACTIVE + integer bpm_numeric=${NUMERIC:-1} + integer bpm_limit=$UNDO_LIMIT_NO bpm_undo=$UNDO_CHANGE_NO + zle .split-undo + UNDO_LIMIT_NO=$UNDO_CHANGE_NO + BUFFER= + CURSOR=1 + fc -p -a /dev/null 0 0 if [[ $bmp_keymap = vicmd ]]; then zle -K viins fi + # There are active widgets. Reprocess $PASTED as keystrokes. + NUMERIC=1 + zle -U - $PASTED + # Just in case there are active undo widgets - zle .split-undo - integer bpm_limit=$UNDO_LIMIT_NO bpm_undo=$UNDO_CHANGE_NO - UNDO_LIMIT_NO=$UNDO_CHANGE_NO while [[ -n $PASTED ]] && zle .read-command; do PASTED=${PASTED#$KEYS} @@ -183,21 +182,16 @@ bracketed-paste-magic() { done PASTED=$BUFFER - # Reset the undo state + # Restore state + zle -K $bpm_keymap + fc -P + MARK=$bpm_mark + REGION_ACTIVE=$bpm_region + NUMERIC=$bpm_numeric zle .undo $bpm_undo UNDO_LIMIT_NO=$bpm_limit - - zle -K $bpm_keymap fi - # Restore state - BUFFER=$bpm_buffer - MARK=$bpm_mark - CURSOR=$bpm_cursor - REGION_ACTIVE=$bpm_region - NUMERIC=$bpm_numeric - fc -P - # PASTED has been updated, run the paste-finish functions if zstyle -a :bracketed-paste-magic paste-finish bpm_hooks; then for bpm_func in $bpm_hooks; do diff --git a/Functions/Zle/insert-files b/Functions/Zle/insert-files index 10f90ed4a..2d13d82d2 100644 --- a/Functions/Zle/insert-files +++ b/Functions/Zle/insert-files @@ -12,7 +12,7 @@ setopt nobadpattern local key str files -files=( *(N) ) +files=( *(N:q) ) if (( $#files )); then zle -R "files: ${str}_" "$files[@]" else @@ -26,7 +26,7 @@ while [[ '#key' -ne '#\\r' && '#key' -ne '#\\n' && else str="$str$key" fi - eval "files=( \${~str}*(N) )" + eval "files=( \${~str}*(N:q) )" if (( $#files )); then zle -R "files: ${str}_" "$files[@]" else diff --git a/Functions/Zle/insert-unicode-char b/Functions/Zle/insert-unicode-char index af9aad914..b943fb7f7 100644 --- a/Functions/Zle/insert-unicode-char +++ b/Functions/Zle/insert-unicode-char @@ -12,11 +12,11 @@ then local -i 16 -Z 10 arg=$NUMERIC # ...and use print to turn this into a Unicode character. LBUFFER+="$(print -n "\U${arg##0x}")" - _insert_unicode_ready=0 + integer -g _insert_unicode_ready=0 else # Set the base to 16... zle argument-base 16 # ...wait for user to type hex keys then call this widget again. zle universal-argument - _insert_unicode_ready=1 + integer -g _insert_unicode_ready=1 fi diff --git a/Functions/Zle/url-quote-magic b/Functions/Zle/url-quote-magic index 7ee281ea4..cb7bf727a 100644 --- a/Functions/Zle/url-quote-magic +++ b/Functions/Zle/url-quote-magic @@ -10,7 +10,7 @@ # As of zsh-5.1, the following may also be necessary in order to apply # quoting to copy-pasted URLs: -# autload -Uz bracketed-paste-magic +# autoload -Uz bracketed-paste-magic # zle -N bracketed-paste bracketed-paste-magic # See also backward-extend-paste in bracketed-paste-magic source file. |