From 212094220376c948ccfa50948e228856dda6ea43 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Wed, 19 Oct 2005 22:49:36 +0000 Subject: 21891: compose double width characters with ^A etc. --- ChangeLog | 3 +++ Doc/Zsh/contrib.yo | 5 +++++ Functions/Zle/define-composed-chars | 12 ++++++++++++ 3 files changed, 20 insertions(+) diff --git a/ChangeLog b/ChangeLog index 0655968a4..dd89674d0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2005-10-19 Peter Stephenson + * 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" -- cgit 1.4.1