Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: reverse string subscripting



Bart Schaefer wrote:

> ...
> 
> Note the (r) is forward pattern matching, not reverse; (R) is reverse.
> Your patch appears to have fixed the bug only for the forward direction:

Ahem.

Bye
  Sven

Index: Src/params.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/params.c,v
retrieving revision 1.33
diff -u -r1.33 params.c
--- Src/params.c	2001/04/05 11:24:17	1.33
+++ Src/params.c	2001/04/06 07:35:07
@@ -1118,7 +1118,7 @@
 		    if (a2) {
 			if (down) {
 			    if (!hasbeg)
-				beg = len - 1;
+				beg = len;
 			    for (r = beg, t = d + beg; t >= d; r--, t--) {
 				sav = *t;
 				*t = '\0';
@@ -1143,7 +1143,7 @@
 		    } else {
 			if (down) {
 			    if (!hasbeg)
-				beg = len - 1;
+				beg = len;
 			    for (r = beg + 1, t = d + beg; t >= d; r--, t--) {
 				if (pattry(pprog, t) &&
 				    !--num)

-- 
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author