35517457921c095be1aa6ed948debfbe183b89ac

Author
Andrew Janke <andrew@apjanke.net>
Committer
Andrew Janke <andrew@apjanke.net>
Date

Message

Disable bracketed-paste-magic in zsh 5.1.1, where it is buggy

A bracketed-paste-magic bug breaks pasting of CJK and some other characters in zsh 5.1.1.
http://www.zsh.org/mla/workers/2015/msg02680.html
See #4434

Diff

 1diff --git a/lib/misc.zsh b/lib/misc.zsh
 2index 8ff076e77652f7d09557895ba7d39b27f2d97f47..c81dab4139c2aa84f7baa3044b07f0fb6958f79e 100644
 3--- a/lib/misc.zsh
 4+++ b/lib/misc.zsh
 5@@ -1,14 +1,19 @@
 6 ## Load smart urls if available
 7-for d in $fpath; do
 8-	if [[ -e "$d/url-quote-magic" ]]; then
 9-		if [[ -e "$d/bracketed-paste-magic" ]]; then
10-			autoload -Uz bracketed-paste-magic
11-			zle -N bracketed-paste bracketed-paste-magic
12-		fi
13-		autoload -U url-quote-magic
14-		zle -N self-insert url-quote-magic
15-	fi
16-done
17+# bracketed-paste-magic is known buggy in zsh 5.1.1 (only), so skip it there; see #4434
18+autoload -Uz is-at-least
19+if [[ $ZSH_VERSION != 5.1.1 ]]; then
20+  for d in $fpath; do
21+  	if [[ -e "$d/url-quote-magic" ]]; then
22+  		if is-at-least 5.1; then
23+  			autoload -Uz bracketed-paste-magic
24+  			zle -N bracketed-paste bracketed-paste-magic
25+  		fi
26+  		autoload -Uz url-quote-magic
27+  		zle -N self-insert url-quote-magic
28+      break
29+  	fi
30+  done
31+fi
32 
33 ## jobs
34 setopt long_list_jobs
35@@ -22,8 +27,7 @@ alias _='sudo'
36 alias please='sudo'
37 
38 ## more intelligent acking for ubuntu users
39-if which ack-grep &> /dev/null;
40-then
41+if which ack-grep &> /dev/null; then
42   alias afind='ack-grep -il'
43 else
44   alias afind='ack -il'