From b957cdd21a8997739aba48c3637fc3b9f88b2168 Mon Sep 17 00:00:00 2001 From: "Barton E. Schaefer" Date: Sat, 12 Sep 2015 17:16:43 -0700 Subject: unposted: revert 36483 as multibyte is now handled by "zle .read-command"; adapt to new default behavior of zle_highlight for paste --- Functions/Zle/bracketed-paste-magic | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) (limited to 'Functions/Zle/bracketed-paste-magic') diff --git a/Functions/Zle/bracketed-paste-magic b/Functions/Zle/bracketed-paste-magic index 464c6b339..cd4a7085b 100644 --- a/Functions/Zle/bracketed-paste-magic +++ b/Functions/Zle/bracketed-paste-magic @@ -164,25 +164,17 @@ bracketed-paste-magic() { integer bpm_limit=$UNDO_LIMIT_NO bpm_undo=$UNDO_CHANGE_NO UNDO_LIMIT_NO=$UNDO_CHANGE_NO - local mbchar - integer ismb while [[ -n $PASTED ]] && zle .read-command; do - mbchar=$KEYS - ismb=0 - while [[ $mbchar = [[:INCOMPLETE:]]* ]] && zle .read-command; do - mbchar+=$KEYS - ismb=1 - done - PASTED=${PASTED#$mbchar} - if [[ ismb -ne 0 || $mbchar = ${(~j:|:)${(b)bpm_inactive}} ]]; then - LBUFFER+=$mbchar + PASTED=${PASTED#$KEYS} + if [[ $KEYS = ${(~j:|:)${(b)bpm_inactive}} ]]; then + zle .self-insert-unmeta else case $REPLY in (${~bpm_active}) function () { emulate -L $bpm_emulate; set -$bpm_opts zle $REPLY };; - (*) LBUFFER+=$mbchar; + (*) zle .self-insert-unmeta;; esac fi done @@ -221,7 +213,7 @@ bracketed-paste-magic() { zle .split-undo # Arrange to display highlighting if necessary - if [[ -n ${(M)zle_highlight:#paste:*} ]]; then + if [[ -z $zle_highlight || -n ${(M)zle_highlight:#paste:*} ]]; then zle -R zle .read-command && zle -U - $KEYS fi -- cgit v1.2.3 From b947789d7c7a9e01880512dff1f27198f4707e50 Mon Sep 17 00:00:00 2001 From: "Barton E. Schaefer" Date: Wed, 21 Oct 2015 14:47:41 -0700 Subject: 36871: move initial call to "zle .bracketed-paste-magic" to occur earlier in the function Just in case any later initialization might have side-effects. --- ChangeLog | 5 +++++ Functions/Zle/bracketed-paste-magic | 11 +++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) (limited to 'Functions/Zle/bracketed-paste-magic') diff --git a/ChangeLog b/ChangeLog index 04883a152..22e4b9478 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2015-10-21 Barton E. Schaefer + + * 36871: Functions/Zle/bracketed-paste-magic: move initial call + to "zle .bracketed-paste-magic" to occur earlier in the function + 2015-10-20 Daniel Shahaf * 36900: Completion/Unix/Command/_git: _git: stash names diff --git a/Functions/Zle/bracketed-paste-magic b/Functions/Zle/bracketed-paste-magic index cd4a7085b..2368bc315 100644 --- a/Functions/Zle/bracketed-paste-magic +++ b/Functions/Zle/bracketed-paste-magic @@ -116,10 +116,14 @@ quote-paste() { # Now the actual function bracketed-paste-magic() { - # Fast exit in the vi-mode cut-buffer context if [[ "$LASTWIDGET" = *vi-set-buffer ]]; then + # Fast exit in the vi-mode cut-buffer context zle .bracketed-paste return + else + # Capture the pasted text in $PASTED + local PASTED + zle .bracketed-paste PASTED fi # Really necessary to go to this much effort? @@ -127,10 +131,9 @@ bracketed-paste-magic() { emulate -L zsh local -a bpm_hooks bpm_inactive - local PASTED bpm_func bpm_active bpm_keymap=$KEYMAP + local bpm_func bpm_active bpm_keymap=$KEYMAP - # Set PASTED and run the paste-init functions - zle .bracketed-paste PASTED + # Run the paste-init functions if zstyle -a :bracketed-paste-magic paste-init bpm_hooks; then for bpm_func in $bpm_hooks; do if (( $+functions[$bpm_func] )); then -- cgit v1.2.3 From aba7c00698fdd459d2f17f84ed371413458afae5 Mon Sep 17 00:00:00 2001 From: "Barton E. Schaefer" Date: Tue, 27 Oct 2015 20:29:07 -0700 Subject: 36994: declare local REPLY for use with "zle .read-command"; use .self-insert instead of .self-insert-unmeta --- ChangeLog | 6 ++++++ Functions/Zle/bracketed-paste-magic | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'Functions/Zle/bracketed-paste-magic') diff --git a/ChangeLog b/ChangeLog index b10cf06ab..b5da1df4e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2015-10-27 Barton E. Schaefer + + * 36994: Functions/Zle/bracketed-paste-magic: declare local REPLY + for use with "zle .read-command"; use .self-insert instead of + .self-insert-unmeta + 2015-10-27 Peter Stephenson * 36982: Doc/Zsh/expn.yo, Src/pattern.c, Test/D02glob.ztst, diff --git a/Functions/Zle/bracketed-paste-magic b/Functions/Zle/bracketed-paste-magic index 2368bc315..2b2bc630d 100644 --- a/Functions/Zle/bracketed-paste-magic +++ b/Functions/Zle/bracketed-paste-magic @@ -122,7 +122,7 @@ bracketed-paste-magic() { return else # Capture the pasted text in $PASTED - local PASTED + local PASTED REPLY zle .bracketed-paste PASTED fi @@ -170,14 +170,14 @@ bracketed-paste-magic() { while [[ -n $PASTED ]] && zle .read-command; do PASTED=${PASTED#$KEYS} if [[ $KEYS = ${(~j:|:)${(b)bpm_inactive}} ]]; then - zle .self-insert-unmeta + zle .self-insert else case $REPLY in (${~bpm_active}) function () { emulate -L $bpm_emulate; set -$bpm_opts zle $REPLY };; - (*) zle .self-insert-unmeta;; + (*) zle .self-insert;; esac fi done -- cgit v1.2.3