From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14166 invoked from network); 21 Oct 2005 09:27:40 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 21 Oct 2005 09:27:40 -0000 Received: (qmail 1894 invoked from network); 21 Oct 2005 09:27:34 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 21 Oct 2005 09:27:34 -0000 Received: (qmail 21156 invoked by alias); 21 Oct 2005 09:27:31 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 21898 Received: (qmail 21146 invoked from network); 21 Oct 2005 09:27:30 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 21 Oct 2005 09:27:30 -0000 Received: (qmail 1673 invoked from network); 21 Oct 2005 09:27:30 -0000 Received: from cluster-d.mailcontrol.com (HELO rly33d.srv.mailcontrol.com) (217.69.20.190) by a.mx.sunsite.dk with SMTP; 21 Oct 2005 09:27:29 -0000 Received: from exchange03.csr.com (mailhost1.csr.com [81.105.217.43]) by rly33d.srv.mailcontrol.com (MailControl) with ESMTP id j9L9RQOt001095 for ; Fri, 21 Oct 2005 10:27:28 +0100 Received: from news01.csr.com ([10.103.143.38]) by exchange03.csr.com with Microsoft SMTPSVC(5.0.2195.6713); Fri, 21 Oct 2005 10:29:40 +0100 Received: from news01.csr.com (localhost.localdomain [127.0.0.1]) by news01.csr.com (8.13.1/8.12.11) with ESMTP id j9L9RPf2022915 for ; Fri, 21 Oct 2005 10:27:26 +0100 Received: from csr.com (pws@localhost) by news01.csr.com (8.13.1/8.13.1/Submit) with ESMTP id j9L9RPvj022912 for ; Fri, 21 Oct 2005 10:27:25 +0100 Message-Id: <200510210927.j9L9RPvj022912@news01.csr.com> To: zsh-workers@sunsite.dk (Zsh hackers list) Subject: PATCH: arguments for insert-composed-char Date: Fri, 21 Oct 2005 10:27:24 +0100 From: Peter Stephenson X-OriginalArrivalTime: 21 Oct 2005 09:29:40.0188 (UTC) FILETIME=[F62609C0:01C5D621] Content-Type: text/plain MIME-Version: 1.0 X-Scanned-By: MailControl A-05-40-01 (www.mailcontrol.com) on 10.68.0.143 X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.0.4 I could have sworn I'd sent this but I can't see it... Index: Doc/Zsh/contrib.yo =================================================================== RCS file: /cvsroot/zsh/zsh/Doc/Zsh/contrib.yo,v retrieving revision 1.50 diff -u -r1.50 contrib.yo --- Doc/Zsh/contrib.yo 19 Oct 2005 22:49:38 -0000 1.50 +++ Doc/Zsh/contrib.yo 21 Oct 2005 09:20:54 -0000 @@ -671,6 +671,13 @@ two-character codes are a subset of those given by RFC 1345 (see for example tt(http://www.faqs.org/rfcs/rfc1345.html)). +The function may optionally be followed by up to two characters which +replace one or both of the characters read from the keyboard; if both +characters are supplied, no input is read. For example, +tt(insert-composed-char a:) can be used within a widget to insert an a with +umlaut into the command line. This has the advantages over use of a +literal character that it is more portable. + For best results zsh should have been built with support for multibyte characters (configured with tt(--enable-multibyte)); however, the function works for the limited range of characters available in single-byte Index: Functions/Zle/insert-composed-char =================================================================== RCS file: /cvsroot/zsh/zsh/Functions/Zle/insert-composed-char,v retrieving revision 1.2 diff -u -r1.2 insert-composed-char --- Functions/Zle/insert-composed-char 22 Sep 2005 22:23:45 -0000 1.2 +++ Functions/Zle/insert-composed-char 21 Oct 2005 09:20:54 -0000 @@ -147,8 +147,22 @@ unfunction define-composed-chars fi -read -k basechar || return 1 -read -k accent || return 1 +if (( $# )); then + basechar=${1[1]} + if [[ $1 = ? ]]; then + shift + else + 1=${1[2,-1]} + fi +else + read -k basechar || return 1 +fi + +if (( $# )); then + accent=${1[1]} +else + read -k accent || return 1 +fi local -A charmap charmap=(${=zsh_accented_chars[$accent]}) -- Peter Stephenson Software Engineer CSR PLC, Churchill House, Cambridge Business Park, Cowley Road Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070 This message has been scanned for viruses by BlackSpider MailControl - www.blackspider.com