Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Menu selection
- X-seq: zsh-workers 17429
- From: Sven Wischnowsky <wischnow@xxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: Re: Menu selection
- Date: Fri, 5 Jul 2002 10:09:03 +0200
- In-reply-to: <20020704175642.50849.qmail@xxxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <15652.5381.195915.598532@xxxxxxxxxxxxxxxxxx> <20020704175642.50849.qmail@xxxxxxxxxxxxxxxxxxxxxxx>
Felix Rosencrantz wrote:
> It's more robust, but still seeing some problems. He is the use case.
> I was able to get my shell to crash, but not with this use case.
> The use case does scream BUG, so hopefully that will help track the problem.
Urgh, it gets embarassing.
And I can't reproduce this either. In fact, I had seen something like
this before the last patch and fixed it. At least I thought I did.
That message should mean that somehow `showinglist' gets set to `-2'
when leavin menu selection even though there isn't a list to show. I
can only try to make the tests a bit more secure (by also testing
`nolist').
The other hunks improve the behaviour of interactive mode when the
string typed doesn't match anything (it doesn't leave menu selection
so that one can use undo and backspace to go back).
Bye
Sven
Index: Src/Zle/complist.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/complist.c,v
retrieving revision 1.53
diff -u -r1.53 complist.c
--- Src/Zle/complist.c 4 Jul 2002 09:29:22 -0000 1.53
+++ Src/Zle/complist.c 5 Jul 2002 08:06:45 -0000
@@ -1724,7 +1724,7 @@
Brinfo brbeg;
Brinfo brend;
int nbrbeg, nbrend;
- int cs, acc, nmatches, mline, mlbeg;
+ int cs, acc, nmatches, mline, mlbeg, nolist;
struct menuinfo info;
Cmgroup amatches, pmatches, lastmatches, lastlmatches;
char *origline;
@@ -1768,10 +1768,13 @@
p = (char *) zhalloc(cs - wb + 1);
strncpy(p, (char *) line + wb, cs - wb);
p[cs - wb] = '\0';
- s = (char *) zhalloc(lastend - cs + 1);
- strncpy(s, (char *) line + cs, lastend - cs);
- s[lastend - cs] = '\0';
-
+ if (lastend < cs)
+ s = "";
+ else {
+ s = (char *) zhalloc(lastend - cs + 1);
+ strncpy(s, (char *) line + cs, lastend - cs);
+ s[lastend - cs] = '\0';
+ }
cs = 0;
foredel(ll);
spaceinline(sll);
@@ -2117,7 +2120,9 @@
molbeg = -1;
break;
} else if (nolist && cmd != Th(z_undo) &&
- (!mode || cmd != Th(z_backwarddeletechar))) {
+ (!mode || (cmd != Th(z_backwarddeletechar) &&
+ cmd != Th(z_selfinsert) &&
+ cmd != Th(z_selfinsertunmeta)))) {
ungetkeycmd();
break;
} else if (cmd == Th(z_acceptline)) {
@@ -2162,6 +2167,7 @@
s->pmatches = pmatches;
s->lastmatches = lastmatches;
s->lastlmatches = lastlmatches;
+ s->nolist = nolist;
s->acc = menuacc;
s->brbeg = dupbrinfo(brbeg, NULL, 1);
s->brend = dupbrinfo(brend, NULL, 1);
@@ -2258,6 +2264,7 @@
memcpy(&(s->info), &minfo, sizeof(struct menuinfo));
s->amatches = s->pmatches =
s->lastmatches = s->lastlmatches = NULL;
+ s->nolist = nolist;
s->acc = menuacc;
s->brbeg = dupbrinfo(brbeg, NULL, 1);
s->brend = dupbrinfo(brend, NULL, 1);
@@ -2305,7 +2312,7 @@
break;
handleundo();
- cs = nolist = 0;
+ cs = 0;
foredel(ll);
spaceinline(l = strlen(u->line));
strncpy((char *) line, u->line, l);
@@ -2336,6 +2343,7 @@
origll = u->origll;
strcpy(status, u->status);
mode = u->mode;
+ nolist = u->nolist;
u = u->prev;
clearlist = 1;
@@ -2343,6 +2351,16 @@
listdat.valid = 0;
molbeg = -42;
+ if (nolist) {
+ if (mode == MM_INTER) {
+ statusline = status;
+ statusll = strlen(status);
+ }
+ zrefresh();
+ statusline = NULL;
+ statusll = 0;
+ goto getk;
+ }
if (mode)
continue;
} else if (cmd == Th(z_redisplay)) {
@@ -2781,13 +2799,15 @@
mselect = mlastcols = mlastlines = -1;
mstatus = NULL;
inselect = mhasstat = 0;
+ if (nolist)
+ clearlist = listshown = 1;
if (acc && validlist && minfo.cur) {
menucmp = lastambig = hasoldlist = 0;
do_single(*(minfo.cur));
}
if (wasnext || broken) {
menucmp = 2;
- showinglist = (validlist ? -2 : 0);
+ showinglist = ((validlist && !nolist) ? -2 : 0);
minfo.asked = 0;
if (!noselect) {
int nos = noselect;
@@ -2797,10 +2817,10 @@
}
}
if (!noselect && (!dat || acc)) {
- showinglist = (validlist ? -2 : 0);
+ showinglist = ((validlist && !nolist) ? -2 : 0);
onlyexpl = oe;
if (!smatches)
- clearlist = 1;
+ clearlist = listshown = 1;
zrefresh();
}
mlbeg = -1;
--
Sven Wischnowsky wischnow@xxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author