zsh-workers
 help / color / mirror / code / Atom feed
From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
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)	[thread overview]
Message-ID: <200006070837.KAA13541@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: "Bart Schaefer"'s message of Tue, 6 Jun 2000 17:52:11 +0000


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@informatik.hu-berlin.de


                 reply	other threads:[~2000-06-07  8:38 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200006070837.KAA13541@beta.informatik.hu-berlin.de \
    --to=wischnow@informatik.hu-berlin.de \
    --cc=zsh-workers@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).