summary refs log tree commit diff
diff options
context:
space:
mode:
authorBarton E. Schaefer <schaefer@zsh.org>2015-10-21 14:47:41 -0700
committerBarton E. Schaefer <schaefer@zsh.org>2015-10-21 14:47:41 -0700
commitb947789d7c7a9e01880512dff1f27198f4707e50 (patch)
tree0f6c5ba7821a002ee8a51b3b56dda461b884408f
parent98875bcb05d552cc59b300e33fe9000d295b1ffe (diff)
downloadzsh-b947789d7c7a9e01880512dff1f27198f4707e50.tar.gz
zsh-b947789d7c7a9e01880512dff1f27198f4707e50.tar.xz
zsh-b947789d7c7a9e01880512dff1f27198f4707e50.zip
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.
-rw-r--r--ChangeLog5
-rw-r--r--Functions/Zle/bracketed-paste-magic11
2 files changed, 12 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 04883a152..22e4b9478 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-10-21  Barton E. Schaefer  <schaefer@zsh.org>
+
+	* 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  <d.s@daniel.shahaf.name>
 
 	* 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