zsh-workers
 help / color / mirror / code / Atom feed
* Re: feature-request of double-tab-list
@ 1999-01-28 16:49 Sven Wischnowsky
  0 siblings, 0 replies; 4+ messages in thread
From: Sven Wischnowsky @ 1999-01-28 16:49 UTC (permalink / raw)
  To: zsh-workers


Bart Schaefer wrote:

> Way way back on Sep 19,  5:36pm, Rasmus Tengblad wrote:
> } Subject: feature-request of double-tab-list
> }
> } First i'd like to tell you that I really like zsh. Best shell there is!
> } However, there is one small thing I like better about bash, and that's the
> } double-tab-press or what ever you'd want to call it. It's sort of like zsh
> } with AUTO_LIST set, but with the exception that you have to press tab
> } twice before the list is displayed.
> 
> OK, Sven, can we implement this using the new completion stuff?  What, if
> any, hooks are there for keeping track of the first vs. the second press
> of the completion key within the same completion?

We could give free the zle-parameters (LBUFFER,...) in completion
widgets and then do something like:

  local lastl lastr

  if [[ "$LBUFFER" != "$lastl" || "$RBUFFER" != "$lastr" ]] then
    lastl="$LBUFFER"
    lastr="$RBUFFER"
    return
  fi

We should make them readonly in completion widgets, though (since the
match-inserting code could get terribly confused otherwise).

Would that be enough?

Bye
 Sven


--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: feature-request of double-tab-list
@ 1999-01-29  8:31 Sven Wischnowsky
  0 siblings, 0 replies; 4+ messages in thread
From: Sven Wischnowsky @ 1999-01-29  8:31 UTC (permalink / raw)
  To: zsh-workers


I wrote:

> Bart Schaefer wrote:
> 
> > Way way back on Sep 19,  5:36pm, Rasmus Tengblad wrote:
> > } Subject: feature-request of double-tab-list
> > }
> > } First i'd like to tell you that I really like zsh. Best shell there is!
> > } However, there is one small thing I like better about bash, and that's the
> > } double-tab-press or what ever you'd want to call it. It's sort of like zsh
> > } with AUTO_LIST set, but with the exception that you have to press tab
> > } twice before the list is displayed.
> > 
> > OK, Sven, can we implement this using the new completion stuff?  What, if
> > any, hooks are there for keeping track of the first vs. the second press
> > of the completion key within the same completion?
> 
> We could give free the zle-parameters (LBUFFER,...) in completion
> widgets and then do something like:
> 
>   local lastl lastr
> 
>   if [[ "$LBUFFER" != "$lastl" || "$RBUFFER" != "$lastr" ]] then
>     lastl="$LBUFFER"
>     lastr="$RBUFFER"
>     return
>   fi
> 
> We should make them readonly in completion widgets, though (since the
> match-inserting code could get terribly confused otherwise).
> 
> Would that be enough?

No, for a correct solution this wouldn't be enough. For that we would
need information about the last zle widget executed (the one *before*
the one that is currently executing). This should be possible by
adding another zle parameter (sister of BUFFER, CURSOR,...).
Then, when we make those parameters readable in completion widgets, we 
can test if the last widget was the same as the current one.

Bye
 Sven


--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: feature-request of double-tab-list
  1998-09-19 15:36 Rasmus Tengblad
@ 1999-01-28 16:33 ` Bart Schaefer
  0 siblings, 0 replies; 4+ messages in thread
From: Bart Schaefer @ 1999-01-28 16:33 UTC (permalink / raw)
  To: zsh-workers

Way way back on Sep 19,  5:36pm, Rasmus Tengblad wrote:
} Subject: feature-request of double-tab-list
}
} First i'd like to tell you that I really like zsh. Best shell there is!
} However, there is one small thing I like better about bash, and that's the
} double-tab-press or what ever you'd want to call it. It's sort of like zsh
} with AUTO_LIST set, but with the exception that you have to press tab
} twice before the list is displayed.

OK, Sven, can we implement this using the new completion stuff?  What, if
any, hooks are there for keeping track of the first vs. the second press
of the completion key within the same completion?

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com



^ permalink raw reply	[flat|nested] 4+ messages in thread

* feature-request of double-tab-list
@ 1998-09-19 15:36 Rasmus Tengblad
  1999-01-28 16:33 ` Bart Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: Rasmus Tengblad @ 1998-09-19 15:36 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1239 bytes --]

Dear zsh-workers,

First i'd like to tell you that I really like zsh. Best shell there is!
However, there is one small thing I like better about bash, and that's the
double-tab-press or what ever you'd want to call it. It's sort of like zsh
with AUTO_LIST set, but with the exception that you have to press tab
twice before the list is displayed.
Of course the other features of zsh outweighs that one advantage eith
bash, so I still use zsh as my loginshell, as well as favourite
shellscript-interpreter.

I've made an ugly patch that fixes it the way I like it, but it only
hardcodes it into the shell. I'm attaching it to this mail, just to
explain more exactly what it is I'd like.
I suppose the correct way of doing is would be to have a variable that
controls how many times you need to press tab before the list shows, and
the turn the feature on or off with the AUTO_LIST option.
I had plans to fix it this way myself, and send you that patch instead,
but I havn't got around to doing it yet, and I'm not sure I ever will...

Anyway, I hope you'll include something like this in future releases of
zsh.
Cheers!

/Rasmus Tengblad
http://www.lysator.liu.se/~marvin


PS. If this doesn't make any sense to you, don't hesitate to ask.

[-- Attachment #2: Type: TEXT/PLAIN, Size: 1647 bytes --]

diff -r -X skiplist -U 3 zsh/Src/zle.h /home/marvin/src/zsh/Src/zle.h
--- zsh/Src/zle.h	Wed Jul 22 13:26:22 1998
+++ /home/marvin/src/zsh/Src/zle.h	Fri Jul 24 12:27:28 1998
@@ -36,6 +36,12 @@
 #endif
 
 #ifdef ZLE
+
+/* Number of tabs in a sequence needed to show completionlist */
+#define TABS_REQUIRED 2
+
+/* Number of tabs pressed in sequence */
+ZLEXTERN int tabcount;
 
 /* size of line buffer */
 ZLEXTERN int linesz;
diff -r -X skiplist -U 3 zsh/Src/zle_main.c /home/marvin/src/zsh/Src/zle_main.c
--- zsh/Src/zle_main.c	Wed Jul 22 13:26:23 1998
+++ /home/marvin/src/zsh/Src/zle_main.c	Fri Jul 24 12:27:28 1998
@@ -360,6 +360,7 @@
     tv.tv_sec = 0;
 #endif
 
+    tabcount = 0;
     keytimeout = getiparam("KEYTIMEOUT");
     if (!shout) {
 	if (SHTTY != -1)
diff -r -X skiplist -U 3 zsh/Src/zle_tricky.c /home/marvin/src/zsh/Src/zle_tricky.c
--- zsh/Src/zle_tricky.c	Wed Jul 22 13:26:23 1998
+++ /home/marvin/src/zsh/Src/zle_tricky.c	Fri Jul 24 12:27:29 1998
@@ -2994,6 +2994,8 @@
 {
     if(showinglist == -2)
 	listmatches();
+    else
+       tabcount = 0;
     if(validlist) {
 	freearray(amatches);
 	zsfree(rpre);
@@ -3177,9 +3179,10 @@
     }
     /* At this point, we might want a completion listing.  Show the listing *
      * if it is needed.                                                     */
-    if (isset(LISTBEEP))
+    if (isset(LISTBEEP) && tabcount==0)
 	feep();
-    if (isset(AUTOLIST) && !amenu && !showinglist)
+    if ( (isset(AUTOLIST) || (tabcount++ == TABS_REQUIRED-1))
+	 && !amenu && !showinglist)
 	showinglist = -2;
     if(inv)
 	invalidatelist();

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1999-01-29  8:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-01-28 16:49 feature-request of double-tab-list Sven Wischnowsky
  -- strict thread matches above, loose matches on Subject: below --
1999-01-29  8:31 Sven Wischnowsky
1998-09-19 15:36 Rasmus Tengblad
1999-01-28 16:33 ` Bart Schaefer

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).