Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Bug: bracketed-paste-magic + ztcp causes wrong pasted contents for CJK payloads
- X-seq: zsh-workers 36994
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: Bug: bracketed-paste-magic + ztcp causes wrong pasted contents for CJK payloads
- Date: Tue, 27 Oct 2015 20:23:40 -0700
- Cc: Chi Hsuan Yen <yan12125@xxxxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern_com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject:cc :mime-version:content-type; bh=CtgD9S/m2VEsChUo1pGH+ig9NYtBTZu7yFIrnrBaAVo=; b=cjiUsRijmlDFT3AQ30tnJu3SScGJRN5tDJrPlrSo0WCWXGkfuAX8T9eXO4XGIMm+/i W7vT0cKLW7U7Ly3U18f/jRdhFJGeujhvtdGUrgUF3DagizIBZJ1HkqZBLzhfuvJ9ir0v Pobi9bxPvOD8SpIyda4x28QiDX/50AkpZfWJMls4JtZHcfiNh4HQua9CBn6EywpzP5Px 7oRELsktUQs6EK18cXcJWCJ7kIpkJNjBKnLuIz3bUIPRWq9ZwjA4uZxGxjx8hoeswmZy bQTfHn2D5zO8ZRe4WedreXGjWIVTplkkD0o5TyzLtcHX/jNjephqVYy7QtbI23+OI4WX 6gAw==
- In-reply-to: <151027194317.ZM17099@torch.brasslantern.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: <CAMNjDR3xZP9wCuYd-3uoBBPVLa-WPa8rAgkVbPxPOC_gyZPSJg@mail.gmail.com> <CAH+w=7ZJRmbk7QzprgAqL8VWf0zPYxTcoUaZOtzv8aHp4Un6LA@mail.gmail.com> <151015172503.ZM30721@torch.brasslantern.com> <151027194317.ZM17099@torch.brasslantern.com>
On Oct 27, 7:43pm, Bart Schaefer wrote:
}
} (where $REPLY comes from "zle .read-command"). $REPLY is "self-insert"
} and $bpm_active is "self-*" so the first branch ought to be taken, and
} indeed that is what happens if ztcp has never been invoked.
}
} However, if ztcp is run in the correct order with respect to the auto-
} load of bracketed-paste-magic, the case statement goes wrong and the
} (*) condition is taken instead.
AHA!
tcp.c uses setiparam("REPLY"), so depending on whether $REPLY is already
defined or not, it gets initialized as an integer-typed variable, which
means that when "self-insert" is assigned to REPLY, it's treated as an
arithmetic expression and evaluates to 0.
tcp.c, socket.c, and zpty.c all use setiparam("REPLY"), potentially
inflicting this on other modules that later do setsparam("REPLY"). Yet
another reason for Kurtis to run for the hills.
Here's the bracketed-paste-magic repair, but we should consider whether
those modules should be setting REPLY as a string instead.
diff --git a/Functions/Zle/bracketed-paste-magic b/Functions/Zle/bracketed-paste-magic
index 2368bc3..2b2bc63 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author