Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: beep (was: Re: #compdef -k menu-select glitch in 3.1.9)
- X-seq: zsh-workers 11794
- From: Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: PATCH: beep (was: Re: #compdef -k menu-select glitch in 3.1.9)
- Date: Wed, 7 Jun 2000 10:37:42 +0200 (MET DST)
- In-reply-to: "Bart Schaefer"'s message of Tue, 6 Jun 2000 17:52:11 +0000
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
Bart Schaefer wrote:
> ...
>
> } > The other puzzler, with the beeping, still remains.
> }
> } That's because menu-select always returns zero, whereas the other
> } completion widgets return 1 when listing and LISTBEEP is set.
>
> But it isn't listing any more at the time of the beep! I get the beep
> when I *exit* from menu selection with a choice, not when I *enter* menu
> selection (which would make more sense from the listbeep standpoint).
Yes, that was because the completion code didn't beep itself, it tried
to control that with its return value.
> } I don't have any opinion here since I don't let it beep at me at
> } all... what do you want to have?
>
> I don't believe menu selection should be considered a listing for the
> purposes of listbeep, no matter how you got there; but if it is going to
> be, then it ought to beep before and not after.
Hm. But menu-selection does display a list and it is only entered when
the completion is ambiguous. Because of that I've made it beep, so
that people who use LISTBEEP can try it. If it feels wrong, it's easy
to change.
Bye
Sven
Index: Src/Zle/compcore.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/compcore.c,v
retrieving revision 1.29
diff -u -r1.29 compcore.c
--- Src/Zle/compcore.c 2000/06/03 16:37:25 1.29
+++ Src/Zle/compcore.c 2000/06/07 08:32:14
@@ -500,16 +500,17 @@
/**/
int
-after_complete(Hookdef dummy, Compldat dat)
+after_complete(Hookdef dummy, int *dat)
{
if (menucmp && !oldmenucmp) {
- struct chdata dat;
+ struct chdata cdat;
int ret;
- dat.matches = amatches;
- dat.num = nmatches;
- dat.cur = NULL;
- if ((ret = runhookdef(MENUSTARTHOOK, (void *) &dat))) {
+ cdat.matches = amatches;
+ cdat.num = nmatches;
+ cdat.cur = NULL;
+ if ((ret = runhookdef(MENUSTARTHOOK, (void *) &cdat))) {
+ dat[1] = 0;
menucmp = menuacc = 0;
if (ret == 2) {
fixsuffix();
Index: Src/Zle/complist.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/complist.c,v
retrieving revision 1.21
diff -u -r1.21 complist.c
--- Src/Zle/complist.c 2000/05/31 09:56:12 1.21
+++ Src/Zle/complist.c 2000/06/07 08:32:15
@@ -1624,7 +1624,7 @@
Thingy cmd;
Menustack u = NULL;
int i = 0, acc = 0, wishcol = 0, setwish = 0, oe = onlyexpl, wasnext = 0;
- int space, lbeg = 0, step = 1, wrap, pl = nlnct, broken = 0;
+ int space, lbeg = 0, step = 1, wrap, pl = nlnct, broken = 0, first = 1;
char *s;
if (fdat || (dummy && (!(s = getsparam("MENUSELECT")) ||
@@ -1712,6 +1712,9 @@
lbeg = mlbeg;
onlyexpl = 0;
showinglist = -2;
+ if (first && !listshown && isset(LISTBEEP))
+ zbeep();
+ first = 0;
zrefresh();
inselect = 1;
if (noselect) {
@@ -1745,9 +1748,10 @@
getk:
- if (!(cmd = getkeycmd()) || cmd == Th(z_sendbreak))
+ if (!(cmd = getkeycmd()) || cmd == Th(z_sendbreak)) {
+ zbeep();
break;
- else if (cmd == Th(z_acceptline)) {
+ } else if (cmd == Th(z_acceptline)) {
acc = 1;
break;
} else if (cmd == Th(z_acceptandinfernexthistory)) {
Index: Src/Zle/zle_tricky.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_tricky.c,v
retrieving revision 1.12
diff -u -r1.12 zle_tricky.c
--- Src/Zle/zle_tricky.c 2000/05/23 08:20:57 1.12
+++ Src/Zle/zle_tricky.c 2000/06/07 08:32:15
@@ -536,7 +536,7 @@
docomplete(int lst)
{
char *s, *ol;
- int olst = lst, chl = 0, ne = noerrs, ocs, ret = 0;
+ int olst = lst, chl = 0, ne = noerrs, ocs, ret = 0, dat[2];
if (undoing)
setlastline();
@@ -777,9 +777,11 @@
zsfree(qword);
unmetafy_line();
- runhookdef(AFTERCOMPLETEHOOK, (void *) &lst);
+ dat[0] = lst;
+ dat[1] = ret;
+ runhookdef(AFTERCOMPLETEHOOK, (void *) dat);
- return ret;
+ return dat[1];
}
/* 1 if we are completing the prefix */
--
Sven Wischnowsky wischnow@xxxxxxxxxxxxxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author