* Don't ask why i was trying to do this... @ 2006-11-05 0:23 Mikael Magnusson 2006-11-05 2:24 ` Bart Schaefer 2006-11-05 22:46 ` Peter Stephenson 0 siblings, 2 replies; 4+ messages in thread From: Mikael Magnusson @ 2006-11-05 0:23 UTC (permalink / raw) To: zsh-workers I'm not sure if this is supposed to work or not, print $(eval "echo -n '\\U'{1..200}") outputs the first 200 codepoints on stdout more or less correctly, print -z $(eval "echo -n '\\U'{1..200}") only pushes up until 3 characters after 'y' to the editing stack. -- Mikael Magnusson ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Don't ask why i was trying to do this... 2006-11-05 0:23 Don't ask why i was trying to do this Mikael Magnusson @ 2006-11-05 2:24 ` Bart Schaefer 2006-11-05 13:48 ` Mikael Magnusson 2006-11-05 22:46 ` Peter Stephenson 1 sibling, 1 reply; 4+ messages in thread From: Bart Schaefer @ 2006-11-05 2:24 UTC (permalink / raw) To: zsh-workers On Nov 4, 4:23pm, Mikael Magnusson wrote: } } print -z $(eval "echo -n '\\U'{1..200}") } only pushes up until 3 characters after 'y' to the editing stack. Hmm, with the latest cvs update I get schaefer<502> print -z $(eval "echo -n '\\U'{1..200}") zsh: character not in range schaefer<503> ^A ^B ^C ^D ^E ^F ^G ^H ^P ^Q ^R ^S ^T ^U ^V ^W ^X ^Y ! " # $ % & ' ( ) 0 1 2 3 4 5 6 7 8 9 @ A B C D E F G H I P Q R S T U V W X Y ` a b c d e f g h i p q r s t u v w x y ^À ^Á ^Â ^@^Ä ^Å ^Æ ^Ç ^È ^É ^Ð ^Ñ ^Ò ^Ó ^Ô ^Õ ^Ö ^× ^Ø ^Ù I suspect that NUL byte (displayed as ^@ above) has something to do with your problem. ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Don't ask why i was trying to do this... 2006-11-05 2:24 ` Bart Schaefer @ 2006-11-05 13:48 ` Mikael Magnusson 0 siblings, 0 replies; 4+ messages in thread From: Mikael Magnusson @ 2006-11-05 13:48 UTC (permalink / raw) To: Bart Schaefer; +Cc: zsh-workers On 05/11/06, Bart Schaefer <schaefer@brasslantern.com> wrote: > On Nov 4, 4:23pm, Mikael Magnusson wrote: > } > } print -z $(eval "echo -n '\\U'{1..200}") > } only pushes up until 3 characters after 'y' to the editing stack. > > Hmm, with the latest cvs update I get > > schaefer<502> print -z $(eval "echo -n '\\U'{1..200}") > zsh: character not in range > schaefer<503> ^A ^B ^C ^D ^E ^F ^G ^H ^P ^Q ^R ^S ^T ^U ^V ^W ^X ^Y ! " # $ % & > ' ( ) 0 1 2 3 4 5 6 7 8 9 @ A B C D E F G H I P Q R S T U V W X Y ` a b c d e f > g h i p q r s t u v w x y ^À ^Á ^Â ^@^Ä ^Å ^Æ ^Ç ^È ^É ^Ð ^Ñ ^Ò ^Ó ^Ô ^Õ ^Ö ^× > ^Ø ^Ù > > I suspect that NUL byte (displayed as ^@ above) has something to do with > your problem. (locale is sv_SE) % print -z $(eval "echo -n '\\U'{1..200}") % ^A ^B ^C ^D ^E ^F ^G ^H ^P ^Q ^R ^S ^T ^U ^V ^W ^X ^Y ! " # $ % & ' ( ) 0 1 2 3 4 5 6 7 8 9 @ A B C D E F G H I P Q R S T U V W X Y ` a b c d e f g h i p q r s t u v w x y ^À ^Á ^Â % export LC_ALL=C % print -z $(eval "echo -n '\\U'{1..200}") zsh: character not in range % ^A ^B ^C ^D ^E ^F ^G ^H ^P ^Q ^R ^S ^T ^U ^V ^W ^X ^Y ! " # $ % & ' ( ) 0 1 2 3 4 5 6 7 8 9 @ A B C D E F G H I P Q R S T U V W X Y ` a b c d e f g h i p q r s t u v w x y % export LC_ALL=en_US % print -z $(eval "echo -n '\\U'{1..200}") zsh: character not in range % ^A ^B ^C ^D ^E ^F ^G ^H ^P ^Q ^R ^S ^T ^U ^V ^W ^X ^Y ! " # $ % & ' ( ) 0 1 2 3 4 5 6 7 8 9 @ A B C D E F G H I P Q R S T U V W X Y ` a b c d e f g h i p q r s t u v w x y ^À ^Á ^Â ^@^Ä ^Å ^Æ ^Ç ^È ^É ^Ð ^Ñ ^Ò ^Ó ^Ô ^Õ ^Ö ^× ^Ø ^Ù -- Mikael Magnusson ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Don't ask why i was trying to do this... 2006-11-05 0:23 Don't ask why i was trying to do this Mikael Magnusson 2006-11-05 2:24 ` Bart Schaefer @ 2006-11-05 22:46 ` Peter Stephenson 1 sibling, 0 replies; 4+ messages in thread From: Peter Stephenson @ 2006-11-05 22:46 UTC (permalink / raw) To: zsh-workers On Sun, 5 Nov 2006 01:23:37 +0100 "Mikael Magnusson" <mikachu@gmail.com> wrote: > I'm not sure if this is supposed to work or not, > print $(eval "echo -n '\\U'{1..200}") > outputs the first 200 codepoints on stdout more or less correctly, > print -z $(eval "echo -n '\\U'{1..200}") > only pushes up until 3 characters after 'y' to the editing stack. Right, normal print handles unmetafied output correctly, but options -z as well as -s don't. \U83 contains a character which, when unmetafied, looks just like the Meta character. It's therefore very useful for testing. (As you probably already know, \U assumes the argument is hexadecimal, so the '\\U'{1..200}, which gives it decimal numbers, is a bit illogical, but that's not relevant to the bug.) This bug isn't new---someone decided it would be fantastic for getkeystring(), which does interpretation of character escapes for print, to return unmetafied output, since it would be easy to fix up bin_print() to handle that, wouldn't it? It isn't even documented. (In case you think I sound bitter, the motto of the CSR firmware group used to be "non sumus amari", which is Latin for "we're not bitter".) By the way, a rewrite of getkeystring() is part of my improvement for unquoting in completion, if that ever sees the light of day. Sorry, doing it again. Index: Src/builtin.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/builtin.c,v retrieving revision 1.164 diff -u -r1.164 builtin.c --- Src/builtin.c 5 Oct 2006 21:53:26 -0000 1.164 +++ Src/builtin.c 5 Nov 2006 21:38:40 -0000 @@ -3454,6 +3454,14 @@ else \ count += fprintf(fout, spec, width, VAL); +/* + * Because of the use of getkeystring() to interpret the arguments, + * the elements of args spend a large part of the function unmetafied + * with the lengths in len. This may have seemed a good idea once. + * As we are stuck with this for now, we need to be very careful + * deciding what state args is in. + */ + /**/ int bin_print(char *name, char **args, Options ops, int func) @@ -3727,6 +3735,14 @@ /* normal output */ if (!fmt) { + if (OPT_ISSET(ops, 'z') || OPT_ISSET(ops, 's')) { + /* + * We don't want the arguments unmetafied after all. + */ + for (n = 0; n < argc; n++) + metafy(args[n], len[n], META_NOALLOC); + } + /* -z option -- push the arguments onto the editing buffer stack */ if (OPT_ISSET(ops,'z')) { queue_signals(); -- Peter Stephenson <p.w.stephenson@ntlworld.com> Web page now at http://homepage.ntlworld.com/p.w.stephenson/ ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2006-11-05 21:47 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2006-11-05 0:23 Don't ask why i was trying to do this Mikael Magnusson 2006-11-05 2:24 ` Bart Schaefer 2006-11-05 13:48 ` Mikael Magnusson 2006-11-05 22:46 ` Peter Stephenson
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).