From: "Zvi Har'El" <rl@math.technion.ac.il>
To: Peter Stephenson <pws@csr.com>
Cc: Zsh hackers list <zsh-workers@sunsite.dk>
Subject: Re: insert-unicode-char
Date: Thu, 24 Nov 2005 17:01:45 +0200 [thread overview]
Message-ID: <20051124150145.GC1880@fermat.math.technion.ac.il> (raw)
In-Reply-To: <EXCHANGE03HZv7FDwfC0000dc24@exchange03.csr.com>
Thanks, it works!
On Thu, 24 Nov 2005 14:39:09 +0000, Peter Stephenson wrote about "Re: insert-unicode-char":
> "Zvi Har'El" wrote:
> > I am trying to use the new insert-unicode-char in a vi emulation - insetmode,
> > using
> >
> > autoload insert-unicode-char
> > zle -N insert-unicode-char
> > bindkey -v '^y' insert-unicode-char
> >
> > It works, accept I cannot enter two unicode characters in a row.
>
> Yes, that was an oversight. It needs an extra flag to check that it's
> really on the second stage rather than the first, otherwise it gets
> confused by back-to-back uses.
>
> Index: Functions/Zle/insert-unicode-char
> ===================================================================
> RCS file: /cvsroot/zsh/zsh/Functions/Zle/insert-unicode-char,v
> retrieving revision 1.3
> diff -u -r1.3 insert-unicode-char
> --- Functions/Zle/insert-unicode-char 24 Nov 2005 10:25:34 -0000 1.3
> +++ Functions/Zle/insert-unicode-char 24 Nov 2005 14:35:35 -0000
> @@ -1,7 +1,10 @@
> # Make hex integers appear as 0x...
> setopt localoptions cbases
>
> -if [[ $LASTWIDGET = insert-unicode-char ]]; then
> +integer -g _insert_unicode_ready
> +
> +if [[ $LASTWIDGET = insert-unicode-char && $_insert_unicode_ready -eq 1 ]]
> +then
> # Second call; we should have a usable prefix.
> # If we don't, give up.
> (( ${+NUMERIC} )) || return 1
> @@ -9,9 +12,11 @@
> local -i 16 -Z 10 arg=$NUMERIC
> # ...and use print to turn this into a Unicode character.
> LBUFFER+="$(print -n "\U${arg##0x}")"
> + _insert_unicode_ready=0
> else
> # Set the base to 16...
> zle argument-base 16
> # ...wait for user to type hex keys then call this widget again.
> zle universal-argument
> + _insert_unicode_ready=1
> fi
>
> --
> Peter Stephenson <pws@csr.com> 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
--
Dr. Zvi Har'El mailto:rl@math.technion.ac.il Department of Mathematics
tel:+972-54-4227607 icq:179294841 Technion - Israel Institute of Technology
fax:+972-4-8293388 http://www.math.technion.ac.il/~rl/ Haifa 32000, ISRAEL
"If you can't say somethin' nice, don't say nothin' at all." -- Thumper (1942)
Thursday, 22 Heshvan 5766, 24 November 2005, 5:01PM
prev parent reply other threads:[~2005-11-24 15:02 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-24 14:08 insert-unicode-char Zvi Har'El
2005-11-24 14:33 ` insert-unicode-char Zvi Har'El
2005-11-24 14:57 ` insert-unicode-char Zvi Har'El
2005-11-25 11:10 ` insert-unicode-char Peter Stephenson
2005-11-24 14:39 ` insert-unicode-char Peter Stephenson
2005-11-24 15:01 ` Zvi Har'El [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20051124150145.GC1880@fermat.math.technion.ac.il \
--to=rl@math.technion.ac.il \
--cc=pws@csr.com \
--cc=zsh-workers@sunsite.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).