Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: displaying wide characters



> Oliver pointed out there are wide ASCII characters at the top of the
> basic multilingual plane, from U+ff00 onward, which can be used for
> testing.  Iʼd be happy to add these to define-composed-chars for
> convenience but couldnʼt offhand see how to do it intuitively without
> clashing with RFC1345.  (Iʼve just realised I could use ^a etc. since
> RFC1345 doesnʼt assume youʼve got ^ on the keyboard, but after three
> solid hours at this I need a rest (nearly wrote "reset").)

Here they are.

Index: Doc/Zsh/contrib.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/contrib.yo,v
retrieving revision 1.49
diff -u -r1.49 contrib.yo
--- Doc/Zsh/contrib.yo	17 Oct 2005 09:51:48 -0000	1.49
+++ Doc/Zsh/contrib.yo	19 Oct 2005 22:47:16 -0000
@@ -719,6 +719,11 @@
 
 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()
Index: Functions/Zle/define-composed-chars
===================================================================
RCS file: /cvsroot/zsh/zsh/Functions/Zle/define-composed-chars,v
retrieving revision 1.2
diff -u -r1.2 define-composed-chars
--- Functions/Zle/define-composed-chars	17 Oct 2005 09:51:48 -0000	1.2
+++ Functions/Zle/define-composed-chars	19 Oct 2005 22:47:17 -0000
@@ -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 @@
 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"


-- 
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page still at http://www.pwstephenson.fsnet.co.uk/



Messages sorted by: Reverse Date, Date, Thread, Author