about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2005-10-19 22:49:36 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2005-10-19 22:49:36 +0000
commit212094220376c948ccfa50948e228856dda6ea43 (patch)
tree7ca36cf277cd2f0803e5f14ea7cd76afd4db2e33
parent2ddaeb605f4b7a89dab23a843ae79fbdc88afa69 (diff)
downloadzsh-212094220376c948ccfa50948e228856dda6ea43.tar.gz
zsh-212094220376c948ccfa50948e228856dda6ea43.tar.xz
zsh-212094220376c948ccfa50948e228856dda6ea43.zip
21891: compose double width characters with ^A etc.
-rw-r--r--ChangeLog3
-rw-r--r--Doc/Zsh/contrib.yo5
-rw-r--r--Functions/Zle/define-composed-chars12
3 files changed, 20 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 0655968a4..dd89674d0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2005-10-19  Peter Stephenson  <p.w.stephenson@ntlworld.com>
 
+	* 21891: Functions/Zle/define-composed-chars, Doc/Zsh/contrib.yo:
+	double width characters can be composed with ^A etc.
+
 	* 21890: Src/builtin.c, Src/prompt.c, Src/zle_utils.c: allocation
 	inconsistencies in print builtin, segmentation error with
 	left prompt truncation from 21882, warning about variable
diff --git a/Doc/Zsh/contrib.yo b/Doc/Zsh/contrib.yo
index 7538d0d12..9baee7a1b 100644
--- a/Doc/Zsh/contrib.yo
+++ b/Doc/Zsh/contrib.yo
@@ -719,6 +719,11 @@ endsitem()
 
 The most common characters from the Arabic, Cyrillic, Greek and Hebrew
 alphabets are available; consult RFC 1345 for the appropriate sequences.
+In addition, a set of two letter codes not in RFC 1345 are available for
+the double-width characters corresponding to ASCII characters from tt(!)
+to tt(~) (0x21 to 0x7e) by preceeding the character with tt(^), for
+example tt(^A) for a double-width tt(A).
+
 The following other two-character sequences are understood.
 
 startitem()
diff --git a/Functions/Zle/define-composed-chars b/Functions/Zle/define-composed-chars
index f6d47c53a..f15f8e38c 100644
--- a/Functions/Zle/define-composed-chars
+++ b/Functions/Zle/define-composed-chars
@@ -1,6 +1,9 @@
 # This is not a widget function, it is only a helper for insert-composed-char
 # to cut down on resident memory use.
 
+emulate -L zsh
+setopt cbases
+
 # The associative array zsh_accent_chars is indexed by the
 # accent.  The values are sets of character / Unicode pairs for
 # the character with the given accent.  The Unicode value is
@@ -249,6 +252,15 @@ z[$a]+=" Z 5e6"
 a=h
 z[$a]+=" S 5e9"
 
+typeset -i 16 -Z 4 ia
+typeset -i 16 -Z 6 iuni
+# Extended width characters ^A, ^B, ... (not RFC1345)
+for (( ia = 0x21; ia < 0x7f; ia++ )); do
+  (( iuni = ia + 0xff00 - 0x20 ))
+  eval a="\$'\\x${ia##0x}'"
+  z[$a]+=" ^ ${iuni##0x}"
+done
+
 # Card suits: here first character is the interesting one
 for a b in S 2660 H 2661 D 2662 C 2663; do
   z[$a]+=" c $b"