From 61e68d70da5af5afe943f92cd94a8c96e78348d9 Mon Sep 17 00:00:00 2001 From: Tanaka Akira Date: Sun, 1 Aug 1999 14:48:28 +0000 Subject: zsh-3.1.6 --- Src/Zle/zle_tricky.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'Src/Zle/zle_tricky.c') diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c index 9c7a19d87..9f4fa0c93 100644 --- a/Src/Zle/zle_tricky.c +++ b/Src/Zle/zle_tricky.c @@ -568,6 +568,8 @@ acceptlast(void) cs = minfo.pos + minfo.len + minfo.insc - (*(minfo.cur))->qisl; if (cs < l) foredel(l - cs); + else if (cs > ll) + cs = ll; inststrlen(" ", 1, 1); if (parpre) inststr(parpre); @@ -2121,6 +2123,7 @@ abort_match(void) { free_cline(matchparts); free_cline(matchsubs); + matchparts = matchsubs = NULL; } /* This adds a new string in the static char buffer. The arguments are @@ -2615,6 +2618,7 @@ comp_match(char *pfx, char *sfx, char *w, Comp cp, chuck(r); /* We still break it into parts here, trying to build a sensible * cline list for these matches, too. */ + w = dupstring(w); wl = strlen(w); *clp = bld_parts(w, wl, wl, NULL); *exact = 0; @@ -6280,8 +6284,8 @@ makecomplistflags(Compctl cc, char *s, int incmd, int compadd) gen_matches_files(1, 0, 0); /* The compctl has a glob pattern (compctl -g). */ if (cc->glob) { - int ns, pl = strlen(prpre), o; - char *g = dupstring(cc->glob), pa[PATH_MAX]; + int ns, pl = strlen(prpre), o, paalloc; + char *g = dupstring(cc->glob), *pa; char *p2, *p3; int ne = noerrs, md = opts[MARKDIRS]; @@ -6295,8 +6299,9 @@ makecomplistflags(Compctl cc, char *s, int incmd, int compadd) } noerrs = 1; addwhat = -6; + o = strlen(prpre); + pa = (char *)zalloc(paalloc = o + PATH_MAX); strcpy(pa, prpre); - o = strlen(pa); opts[MARKDIRS] = 0; /* The compctl -g string may contain more than * @@ -6335,6 +6340,10 @@ makecomplistflags(Compctl cc, char *s, int incmd, int compadd) else { /* It's a simple pattern, so append it to * * the path we have on the command line. */ + int minlen = o + strlen(g); + if (minlen >= paalloc) + pa = (char *) + zrealloc(pa, paalloc = minlen+1); strcpy(pa + o, g); addlinknode(l, dupstring(pa)); } @@ -6380,6 +6389,8 @@ makecomplistflags(Compctl cc, char *s, int incmd, int compadd) glob_pre = glob_suf = NULL; noerrs = ne; opts[MARKDIRS] = md; + + zfree(pa, paalloc); } } dirs++; -- cgit 1.4.1