Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Pasting UTF-8 characters with bracketed-paste-magic seems broken in 5.1
On Thu, 10 Sep 2015 19:57:13 +0100
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx> wrote:
> Now should be possible to do more in shell code...
This seems to be getting somewhere, but possibly needs more expert
examination...
I suppose I'd better leave making a build till tomorrow.
pws
diff --git a/Functions/Zle/bracketed-paste-magic b/Functions/Zle/bracketed-paste-magic
index 49f4b66..464c6b3 100644
--- a/Functions/Zle/bracketed-paste-magic
+++ b/Functions/Zle/bracketed-paste-magic
@@ -164,17 +164,25 @@ 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
- PASTED=${PASTED#$KEYS}
- if [[ $KEYS = ${(~j:|:)${(b)bpm_inactive}} ]]; then
- zle .self-insert-unmeta
+ 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
else
case $REPLY in
(${~bpm_active}) function () {
emulate -L $bpm_emulate; set -$bpm_opts
zle $REPLY
};;
- (*) zle .self-insert-unmeta;;
+ (*) LBUFFER+=$mbchar;
esac
fi
done
Messages sorted by:
Reverse Date,
Date,
Thread,
Author