about summary refs log tree commit diff
path: root/Src/subst.c
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-09-06 12:38:34 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-09-06 12:38:34 +0000
commitf39f39039c78588a0f062b3da87e623a609d0088 (patch)
tree01878e400065e16d702ec518a2f633c33aa72911 /Src/subst.c
parent01add399fa776cf4127103c246a7b6db6bacc33c (diff)
downloadzsh-f39f39039c78588a0f062b3da87e623a609d0088.tar.gz
zsh-f39f39039c78588a0f062b3da87e623a609d0088.tar.xz
zsh-f39f39039c78588a0f062b3da87e623a609d0088.zip
zsh-users/2576
Diffstat (limited to 'Src/subst.c')
-rw-r--r--Src/subst.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/Src/subst.c b/Src/subst.c
index a86f1dc93..91a368d72 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -1143,12 +1143,21 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub)
 		case PM_RIGHT_Z:
 		case PM_RIGHT_Z | PM_RIGHT_B:
 		    if (strlen(val) < fwidth) {
-			t = (char *)ncalloc(fwidth + 1);
-			memset(t, (v->pm->flags & PM_RIGHT_B) ? ' ' : '0', fwidth);
-			if ((t0 = strlen(val)) > fwidth)
-			    t0 = fwidth;
-			strcpy(t + (fwidth - t0), val);
-			val = t;
+			t = NULL;
+			if (v->pm->flags & PM_RIGHT_Z) {
+			    for (t = val; iblank(*t); t++);
+			    if (t && idigit(*t))
+				val = t, t = NULL;
+			}
+			if (!t) {
+			    t = (char *)ncalloc(fwidth + 1);
+			    memset(t, (v->pm->flags & PM_RIGHT_B) ? ' ' : '0', 
+				   fwidth);
+			    if ((t0 = strlen(val)) > fwidth)
+				t0 = fwidth;
+			    strcpy(t + (fwidth - t0), val);
+			    val = t;
+			}
 		    } else {
 			t = (char *)ncalloc(fwidth + 1);
 			t[fwidth] = '\0';