zsh-workers
 help / color / mirror / code / Atom feed
From: Zhiming Wang <zmwangx@gmail.com>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: zsh-workers@zsh.org
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	[thread overview]
Message-ID: <1F5893A8-F2D1-4AF5-941F-88ED32DD3FC8@gmail.com> (raw)
In-Reply-To: <CAH+w=7ZbZdfN7rhXQ-yi4_kqyjyAv1w8B7hKi55TPEBnc5Yfvg@mail.gmail.com>

On Dec 6, 2016, at 10:25 PM, Bart Schaefer <schaefer@brasslantern.com> 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@gmail.com>
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



  reply	other threads:[~2016-12-07  4:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-07  2:57 Zhiming Wang
2016-12-07  3:25 ` Bart Schaefer
2016-12-07  4:02   ` Zhiming Wang [this message]
2016-12-07 12:39   ` Oliver Kiddle
2016-12-07 18:23     ` Zhiming Wang
2016-12-24  8:28     ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1F5893A8-F2D1-4AF5-941F-88ED32DD3FC8@gmail.com \
    --to=zmwangx@gmail.com \
    --cc=schaefer@brasslantern.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).