Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Regression in bracketed-paste-magic (not in 5.2, but affects 5.3's test releases)
- X-seq: zsh-workers 40115
- From: Zhiming Wang <zmwangx@xxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Subject: Re: Regression in bracketed-paste-magic (not in 5.2, but affects 5.3's test releases)
- Date: Tue, 6 Dec 2016 23:02:22 -0500
- Cc: zsh-workers@xxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed;        d=gmail.com; s=20120113;        h=mime-version:subject:from:in-reply-to:date:cc         :content-transfer-encoding:message-id:references:to;        bh=jFkpCoyqKG+OR58D6bpEAUtOQYbjI0CD+4X5gLa+eLY=;        b=a1QSB1uuSMyg8RCjvffFtbLP6GenwB92J+nWKpDi8hS57im+DS+8q6x1wrqEA21JFS         5sGvcsPh8LsUL4TQbZw7SPN916lY5bZ3g5J9rsbO7Ms1N1P1/TLeMB5qr5M3B1rQXwvS         n6HCd98WnKFdpxWBxbq+yXNdjTjWhHd0cYJGIr/lpP7yZr7jQl6Oa6da2EflRM/Zys43         iDi6XKyrjp4Nb8CM8batsmySAlnsfGhavDnU7J88k18gNGgmmQPqhIZtYi3ed8m90und         b3LgjrAouUmYVEUy6AWRlmxLz0zDF5b2VstnJBBCB2YOoap78bwbvvWAFysuXNSM9JhL         4UjA==
- In-reply-to: <CAH+w=7ZbZdfN7rhXQ-yi4_kqyjyAv1w8B7hKi55TPEBnc5Yfvg@mail.gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <B3CEC842-B789-472A-8C8B-89391950787A@gmail.com> <CAH+w=7ZbZdfN7rhXQ-yi4_kqyjyAv1w8B7hKi55TPEBnc5Yfvg@mail.gmail.com>
On Dec 6, 2016, at 10:25 PM, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> For the 5.3 release the easiest approach is likely to be to back out that
> change and re-apply it after the release when it can be more thoroughly
> debugged.
Sounds good. I have verified that a revert restores sanity, for now.
From c1e93b892d9e444d751a073baa329c25cd996471 Mon Sep 17 00:00:00 2001
From: Zhiming Wang <zmwangx@xxxxxxxxx>
Date: Tue, 6 Dec 2016 23:01:33 -0500
Subject: [PATCH] Revert "38579: simplify saving and restoring of state"
This reverts commit 20948d088994dc7b26a26b94926432985fa6863e.
---
 Functions/Zle/bracketed-paste-magic | 44 +++++++++++++++++++++----------------
 1 file changed, 25 insertions(+), 19 deletions(-)
diff --git a/Functions/Zle/bracketed-paste-magic b/Functions/Zle/bracketed-paste-magic
index fb584d595..c46f741d5 100644
--- a/Functions/Zle/bracketed-paste-magic
+++ b/Functions/Zle/bracketed-paste-magic
@@ -145,26 +145,27 @@ 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
-	# 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
-	BUFFER=
-	CURSOR=1
-	zle .split-undo
-	UNDO_LIMIT_NO=$UNDO_CHANGE_NO
-	fc -p -a /dev/null 0 0
+        # There are active widgets.  Reprocess $PASTED as keystrokes.
+	NUMERIC=1
+	zle -U - $PASTED
+
 	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}
@@ -182,16 +183,21 @@ bracketed-paste-magic() {
 	done
 	PASTED=$BUFFER
 
-	# Restore state
-	zle -K $bpm_keymap
-	fc -P
-	MARK=$bpm_mark
-	REGION_ACTIVE=$bpm_region
-	NUMERIC=$bpm_numeric
+	# Reset the undo state
 	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
-- 
2.11.0
Messages sorted by:
Reverse Date,
Date,
Thread,
Author