zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@pwstephenson.fsnet.co.uk>
To: Zsh hackers list <zsh-workers@sunsite.dk>
Subject: Re: UTF-8 input [was Re: PATCH: zle_params.c]
Date: Sun, 30 Jan 2005 01:07:53 +0000	[thread overview]
Message-ID: <20050130010754.6F985863A@pwstephenson.fsnet.co.uk> (raw)
In-Reply-To: <20050129034740.GA21742@scowler.net>

Clint Adams wrote:
> > I've left last_isearch since it's not clear what is to become of it
> > yet.  Fixing doisearch isn't going to be great fun (240 lines, 2
> > comments).  It'll have to wait until we decide about input.
> 
> What needs deciding?

At what stage we turn a character from read() into a wide character.
I argued before that key bindings should still use ordinary character
strings to avoid breaking existing bindings.  Somewhere before we insert
a character in the line we need to accumulate bytes from multibyte
characters where necessary.

I thought of the following: self-insert could take a single character,
as at present, and then test if it was the initial part of a multibyte
character.  If it was, it could read the rest; we might need a timeout to
avoid an infinite hang on systems that didn't do multibyte input
properly, which is potentially quite a lot of them.  This would allow
you to bind all 8-bit characters with the top bit set to self-insert and
voila, multibyte character input with the property (as in UTF-8) that
the 7-bit subset is ASCII is now completely handled, but with the
choice of whether to do so or keep old 8-bit bindings left to users.

This leaves other calls to getkey() and other low-level key handling
routines.  Some might need the same mechanism; isearch is an example,
because some keys are interpreted while some are inserted into the
search string.  A further complication is that when searching the
history we might well want to keep the history lines as multibyte
strings; then the search string remains in that format, too.  As this
example indicates I think each case will need considering on its merits.

In addition to getkey() and friends, there is the related matter of the
variable lastchar.  Currently this is a single character; I'm not yet
100% sure whether we can keep this, or promote it to a wchar_t, or
whether we might need both types.  I fear it may be the last.

-- 
Peter Stephenson <pws@pwstephenson.fsnet.co.uk>
Work: pws@csr.com
Web: http://www.pwstephenson.fsnet.co.uk


  reply	other threads:[~2005-01-30  1:06 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-26 18:06 PATCH: zle_params.c Peter Stephenson
2005-01-26 18:35 ` Clint Adams
2005-01-29  3:47 ` UTF-8 input [was Re: PATCH: zle_params.c] Clint Adams
2005-01-30  1:07   ` Peter Stephenson [this message]
2005-01-30  6:35     ` Bart Schaefer
2005-01-31 11:46       ` Peter Stephenson
2005-01-31 16:18         ` Bart Schaefer
2005-01-31 17:01           ` Peter Stephenson
2005-01-31 18:29             ` Bart Schaefer
2005-02-01 10:37               ` Peter Stephenson
2005-02-10 14:22       ` Peter Stephenson
2005-02-10 14:51         ` Bart Schaefer
2005-02-10 15:06           ` Peter Stephenson

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=20050130010754.6F985863A@pwstephenson.fsnet.co.uk \
    --to=pws@pwstephenson.fsnet.co.uk \
    --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).