zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: Capitalize a parameter containing combined characters
@ 2008-04-26 17:39 ` Jun T.
  2008-04-26 18:13   ` Peter Stephenson
  0 siblings, 1 reply; 3+ messages in thread
From: Jun T. @ 2008-04-26 17:39 UTC (permalink / raw)
  To: zsh-workers

I did some quick tests of parameter expansion with combined characters,
and found a small bug:

zsh$ x=éfg            # é is a combined character, e + U+0301
zsh$ echo ${(C)x}     # capitalize
ÉFg                   # should be "Éfg"

This may be fixed, for example, by the patch below.

Index: Src/hist.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/hist.c,v
retrieving revision 1.75
diff -u -r1.75 hist.c
--- Src/hist.c	17 Apr 2008 10:23:53 -0000	1.75
+++ Src/hist.c	26 Apr 2008 16:53:56 -0000
@@ -1567,6 +1567,8 @@

  	    case CASMOD_CAPS:
  	    default:		/* shuts up compiler */
+		if (IS_COMBINING(wc))
+			break;
  		if (!iswalnum(wc))
  		    nextupper = 1;
  		else if (nextupper) {


-----
Jun

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: PATCH: Capitalize a parameter containing combined characters
  2008-04-26 17:39 ` PATCH: Capitalize a parameter containing combined characters Jun T.
@ 2008-04-26 18:13   ` Peter Stephenson
  2008-04-26 19:41     ` Jun T.
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Stephenson @ 2008-04-26 18:13 UTC (permalink / raw)
  To: zsh-workers

"Jun T." wrote:
> I did some quick tests of parameter expansion with combined characters,
> and found a small bug:
> --- Src/hist.c	17 Apr 2008 10:23:53 -0000	1.75
> +++ Src/hist.c	26 Apr 2008 16:53:56 -0000
> @@ -1567,6 +1567,8 @@
> 
>   	    case CASMOD_CAPS:
>   	    default:		/* shuts up compiler */
> +		if (IS_COMBINING(wc))
> +			break;
>   		if (!iswalnum(wc))
>   		    nextupper = 1;
>   		else if (nextupper) {
> 

IS_COMBINING() is only defined in the multibyte world, so it needs to
be as follows.

Index: Src/hist.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/hist.c,v
retrieving revision 1.75
diff -u -r1.75 hist.c
--- Src/hist.c	17 Apr 2008 10:23:53 -0000	1.75
+++ Src/hist.c	26 Apr 2008 18:12:45 -0000
@@ -1567,6 +1567,10 @@
 
 	    case CASMOD_CAPS:
 	    default:		/* shuts up compiler */
+#ifdef MULTIBYTE_SUPPORT
+		if (IS_COMBINING(wc))
+			break;
+#endif
 		if (!iswalnum(wc))
 		    nextupper = 1;
 		else if (nextupper) {

-- 
Peter Stephenson <p.w.stephenson@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: PATCH: Capitalize a parameter containing combined characters
  2008-04-26 18:13   ` Peter Stephenson
@ 2008-04-26 19:41     ` Jun T.
  0 siblings, 0 replies; 3+ messages in thread
From: Jun T. @ 2008-04-26 19:41 UTC (permalink / raw)
  To: zsh-workers

On 2008/04/27, at 03:13, Peter Stephenson wrote:
>
> IS_COMBINING() is only defined in the multibyte world, so it needs to
> be as follows.

The cord is already within a big block of
#ifdef MULTIBYTE_SUPPORT


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-04-26 19:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <takimoto-j@kba.biglobe.ne.jp>
2008-04-26 17:39 ` PATCH: Capitalize a parameter containing combined characters Jun T.
2008-04-26 18:13   ` Peter Stephenson
2008-04-26 19:41     ` Jun T.

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