From 85e0b5f3770fc0bb84b080740dd578169d4e511c Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Wed, 26 Jan 2005 18:12:08 +0000 Subject: 20752: fix access to ZLE parameters --- Src/Zle/zle_utils.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'Src/Zle/zle_utils.c') diff --git a/Src/Zle/zle_utils.c b/Src/Zle/zle_utils.c index 0e8099bd2..ffd94def8 100644 --- a/Src/Zle/zle_utils.c +++ b/Src/Zle/zle_utils.c @@ -410,9 +410,14 @@ foredel(int ct) /**/ void -setline(char const *s) +setline(char *s, int flags) { - char *scp = ztrdup(s); + char *scp; + + if (flags & ZSL_COPY) + scp = ztrdup(s); + else + scp = s; /* * TBD: we could make this more efficient by passing the existing * allocated line to stringaszleline. @@ -421,10 +426,13 @@ setline(char const *s) zleline = stringaszleline(scp, &zlell, &linesz); - if ((zlecs = zlell) && invicmdmode()) + if ((flags & ZSL_TOEND) && (zlecs = zlell) && invicmdmode()) zlecs--; + else if (zlecs > zlell) + zlecs = zlell; - free(scp); + if (flags & ZSL_COPY) + free(scp); } /**/ -- cgit v1.2.3