zsh-workers
 help / color / mirror / code / Atom feed
* Subscript of negatively-subscripted array element gives incorrect result
@ 2004-03-26  1:56 Jonathan Hankins
  2004-03-26  4:28 ` Bart Schaefer
  2004-03-30 12:28 ` PATCH: " Oliver Kiddle
  0 siblings, 2 replies; 3+ messages in thread
From: Jonathan Hankins @ 2004-03-26  1:56 UTC (permalink / raw)
  To: zsh-workers

Hi,

I reported this previously through the Bugs section on the Sourceforge page 
for zsh, but wasn't sure if it was active.  I also have a bit more 
information.

I am getting different results taking a substring of the same array element 
when I index it negatively than when I index it positively.  Here is an 
example:

These are correct:

% t=(foo bar baz)
% print ${t[2]}
bar
% print ${${t[2]}[1]}
b
% print ${${t[2]}[1,2]}
ba
% print ${${t[2]}[2]}
a
% print ${${t[2]}[2,3]}
ar
%

This is also correct:

% print ${t[-2]}
bar

These are not correct:

% print ${${t[-2]}[1]}
bar
% print ${${t[-2]}[1,2]}
bar
% print ${${t[-2]}[2]}

% print ${${t[-2]}[2,3]}

%

Those last 2 yield an empty string.

I verified this behavior with 4.0.4, 4.0.9, 4.1.1 and 4.2.0 on a Debian 
GNU/Linux system.

Thanks!

-Jonathan Hankins


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

end of thread, other threads:[~2004-03-30 12:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-26  1:56 Subscript of negatively-subscripted array element gives incorrect result Jonathan Hankins
2004-03-26  4:28 ` Bart Schaefer
2004-03-30 12:28 ` PATCH: " Oliver Kiddle

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