zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@csr.com>
To: zsh-workers@sunsite.dk
Subject: Re: printf %s in UTF-8 is not POSIX-compliant
Date: Thu, 6 Mar 2008 17:45:23 +0000	[thread overview]
Message-ID: <20080306174523.15633059@news01> (raw)
In-Reply-To: <080306090901.ZM21797@torch.brasslantern.com>

On Thu, 06 Mar 2008 09:09:01 -0800
Bart Schaefer <schaefer@brasslantern.com> wrote:
> I think "emulate sh" should emulate the POSIX shell to the greatest
> extent possible.  If that means turning off MULTIBYTE, turn it off.

That seems basically sensible.

> However, if "emulate bash" is going to mean something other than a
> synonym for "sh", then some effort should be put into being a bit
> closer to bash than it's currently possible to be.  For example,
> at least set the various BASH_* options, the way "emulate csh" sets
> the smattering of CSH_* options.

I'm not sure the first sentence agrees with the second.  Are you suggesting
new options?

> A final thought on MULTIBYTE:  Is it perhaps reasonable to split this
> into two options, one that affects line editor operations and one that
> affects internals?  If someone does "emulate sh; setopt zle" it seems
> there might be some expectation that ZLE can adapt to a terminal that
> displays multibyte even if the input is all treated as raw bytes once
> accept-line hands it off.  That might mean that e.g. _main_complete
> needs to look at the state of ZLE_MULTIBYTE (or whatever) and setopt
> MULTIBYTE locally to correspond.  Other widgets could also be affected,
> so the emphasis here is on "reasonable."

I think it can be done, and is reasonable if done properly, but is likely
to be bug-prone in the case where one option is on and the other off.  The
library code (mostly in utils.c) will need the correct option passing down
to it, widgets (including basic zle widgets) will need to be careful, and
the combination isn't likely to get well-tested anyway.

Index: Doc/Zsh/options.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/options.yo,v
retrieving revision 1.56
diff -u -r1.56 options.yo
--- Doc/Zsh/options.yo	1 Feb 2008 19:59:48 -0000	1.56
+++ Doc/Zsh/options.yo	6 Mar 2008 17:36:57 -0000
@@ -427,10 +427,10 @@
 Append a trailing `tt(/)' to all directory
 names resulting from filename generation (globbing).
 )
-pindex(MULTIBYTE <D>)
+pindex(MULTIBYTE)
 cindex(characters, multibyte, in expansion and globbing)
 cindex(multibyte characters, in expansion and globbing)
-item(tt(MULTIBYTE))(
+item(tt(MULTIBYTE) <C> <K> <Z>)(
 Respect multibyte characters when found in strings.
 When this option is set, strings are examined using the
 system library to determine how many bytes form a character, depending
@@ -438,8 +438,10 @@
 pattern matching, parameter values and various delimiters.
 
 The option is on by default if the shell was compiled with
-tt(MULTIBYTE_SUPPORT); otherwise it is off by default and has no effect if
-turned on.
+tt(MULTIBYTE_SUPPORT) except in tt(sh) emulation; otherwise it is off by
+default and has no effect if turned on.  The mode is off in tt(sh)
+emulation for compatibility but for interative use may need to be
+turned on if the terminal interprets multibyte characters.
 
 If the option is off a single byte is always treated as a single
 character.  This setting is designed purely for examining strings
Index: Src/options.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/options.c,v
retrieving revision 1.38
diff -u -r1.38 options.c
--- Src/options.c	19 Dec 2007 21:49:35 -0000	1.38
+++ Src/options.c	6 Mar 2008 17:36:57 -0000
@@ -173,7 +173,7 @@
 {{NULL, "monitor",	      OPT_SPECIAL},		 MONITOR},
 {{NULL, "multibyte",
 #ifdef MULTIBYTE_SUPPORT
-			      OPT_ALL
+			      OPT_EMULATE|OPT_ZSH|OPT_CSH|OPT_KSH
 #else
 			      0
 #endif

-- 
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


  reply	other threads:[~2008-03-06 17:45 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-04  1:29 Vincent Lefevre
2008-03-04  1:37 ` Vincent Lefevre
2008-03-04  9:40 ` Peter Stephenson
2008-03-05  0:27   ` Vincent Lefevre
2008-03-05  1:34     ` Bart Schaefer
2008-03-06  1:27       ` Vincent Lefevre
2008-03-05 10:41     ` Peter Stephenson
2008-03-06  1:39       ` Vincent Lefevre
2008-03-06  9:46         ` Peter Stephenson
2008-03-06 17:09       ` Bart Schaefer
2008-03-06 17:45         ` Peter Stephenson [this message]
2008-03-07  2:29           ` Bart Schaefer

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=20080306174523.15633059@news01 \
    --to=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).