zsh-workers
 help / color / mirror / code / Atom feed
* Re: PATCH: _history_complete_word
@ 2000-04-27  9:57 Sven Wischnowsky
  0 siblings, 0 replies; 6+ messages in thread
From: Sven Wischnowsky @ 2000-04-27  9:57 UTC (permalink / raw)
  To: zsh-workers


Adam Spiers wrote:

> ...
> 
> Just noticed another new quirk with h-c-w now.  I have:
> 
>   zstyle ':completion:*:descriptions' format '%B---- %d%b'
>   zstyle ':completion:*:history-words' stop verbose
>   zstyle ':completion:*:history-words' remove_all_dups yep
>                                                         
> The first time I press M-/ the message `---- history word' appears,
> which means that I have to press it twice to get the first match,
> which shouldn't really happen unless the `list' style is turned on.
> How can this be fixed?

I haven't really tried, but I guess this is a result of $historywords
now containing the words from the current command line, too.

In that case "${(@)historywords[2,-1]}" should do the job (see also
Felix' 10894).

> Incidentally, there may still be other outstanding issues with h-c-w
> which I've been meaning to look at for ages but now everything's
> changed so much, I'm not sure I know whether anything needs doing
> about it.  In particular, I'm thinking of what Sven and Bart discussed
> in 8336 and 8341.

No doubt you've been following the discussion with Felix (10894,
10907, 10951). That reminded me of what I said in 8341, too (although
I wouldn't have been able to come up with that number ;-).

Bye
 Sven


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


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

* Re: PATCH: _history_complete_word
  2002-03-07  8:31     ` Sven Wischnowsky
@ 2002-03-07 15:33       ` Adam Spiers
  0 siblings, 0 replies; 6+ messages in thread
From: Adam Spiers @ 2002-03-07 15:33 UTC (permalink / raw)
  To: zsh-workers

Sven Wischnowsky (wischnow@berkom.de) wrote:
> Please see the last discussion about this, which ended with the
> patches in users/3752 and workers/13815.  First, stop has been made a
> boolean style, so you want:
> 
>        zstyle ':completion:*:history-words' stop yes

Noted.

> Second, h-c-w now behaves normally w.r.t. menu-completion, so you have
> to set the menu style if you want menu-completion-only behaviour:
> 
>        zstyle ':completion:*:history-words' menu yes

That appears to do the trick, thanks.

> P.S.: Including the message number of the old article would have
>       helped me.

Sorry, will do next time.  At least I got the References: header right
:-)


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

* Re: PATCH: _history_complete_word
  2002-03-06 14:56   ` Adam Spiers
@ 2002-03-07  8:31     ` Sven Wischnowsky
  2002-03-07 15:33       ` Adam Spiers
  0 siblings, 1 reply; 6+ messages in thread
From: Sven Wischnowsky @ 2002-03-07  8:31 UTC (permalink / raw)
  To: zsh-workers


Adam Spiers wrote:

> Bringing more dead topics back to life ...
> 
> Adam Spiers (adam@spiers.net) wrote:
> > Just noticed another new quirk with h-c-w now.  I have:
> > 
> >   zstyle ':completion:*:descriptions' format '%B---- %d%b'
> >   zstyle ':completion:*:history-words' stop verbose
> >   zstyle ':completion:*:history-words' remove_all_dups yep
> >                                                         
> > The first time I press M-/ the message `---- history word' appears,
> > which means that I have to press it twice to get the first match,
> > which shouldn't really happen unless the `list' style is turned on.
> > How can this be fixed?
> 
> This tiny nit has grown into an itch big enough I need to scratch it.
> These days I also have 
> 
>     zstyle ':completion:*:history-words' list false
> 
> set, so I don't even get the message appearing.  This gives the
> impression of the first keystroke just being swallowed.  This is
> presumably because the
> 
>   [[ $LASTWIDGET = _history-complete-* &&
>      ( -n "$compstate[old_list]" || -n $_hist_stop ) ]]
> 
> condition returns false, so on the first stroke, the matches are
> generated but nothing else happens.  I'm not sure what the best
> solution is.

Please see the last discussion about this, which ended with the
patches in users/3752 and workers/13815.  First, stop has been made a
boolean style, so you want:

       zstyle ':completion:*:history-words' stop yes

Second, h-c-w now behaves normally w.r.t. menu-completion, so you have
to set the menu style if you want menu-completion-only behaviour:

       zstyle ':completion:*:history-words' menu yes

Good?


Bye
  Sven

P.S.: Including the message number of the old article would have
      helped me.

-- 
Sven Wischnowsky                          wischnow@berkom.de


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

* Re: PATCH: _history_complete_word
  2000-04-26 19:49 ` Adam Spiers
@ 2002-03-06 14:56   ` Adam Spiers
  2002-03-07  8:31     ` Sven Wischnowsky
  0 siblings, 1 reply; 6+ messages in thread
From: Adam Spiers @ 2002-03-06 14:56 UTC (permalink / raw)
  To: zsh-workers

Bringing more dead topics back to life ...

Adam Spiers (adam@spiers.net) wrote:
> Just noticed another new quirk with h-c-w now.  I have:
> 
>   zstyle ':completion:*:descriptions' format '%B---- %d%b'
>   zstyle ':completion:*:history-words' stop verbose
>   zstyle ':completion:*:history-words' remove_all_dups yep
>                                                         
> The first time I press M-/ the message `---- history word' appears,
> which means that I have to press it twice to get the first match,
> which shouldn't really happen unless the `list' style is turned on.
> How can this be fixed?

This tiny nit has grown into an itch big enough I need to scratch it.
These days I also have 

    zstyle ':completion:*:history-words' list false

set, so I don't even get the message appearing.  This gives the
impression of the first keystroke just being swallowed.  This is
presumably because the

  [[ $LASTWIDGET = _history-complete-* &&
     ( -n "$compstate[old_list]" || -n $_hist_stop ) ]]

condition returns false, so on the first stroke, the matches are
generated but nothing else happens.  I'm not sure what the best
solution is.


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

* Re: PATCH: _history_complete_word
  2000-03-31  8:14 Sven Wischnowsky
@ 2000-04-26 19:49 ` Adam Spiers
  2002-03-06 14:56   ` Adam Spiers
  0 siblings, 1 reply; 6+ messages in thread
From: Adam Spiers @ 2000-04-26 19:49 UTC (permalink / raw)
  To: zsh-workers

Sven Wischnowsky (wischnow@informatik.hu-berlin.de) wrote:
> I think _history_complete_word could use the new tag label stuff, too.
> 
> There is something in this function I don't understand:
> 
> There is always one match inserted immediately. That's ok for a
> function like this, but why does _h_c_w then test for
> `$compstate[insert] = menu'?

Peter added that in 8070, giving the reason that without it, h-c-w
`has the unfortunate effect that menu completion is turned off unless
history_stop is set, even if you usually have it on.'

> It means that this is almost unusable without normally using
> menucompletion (one can't cycle through the matches).

My brain aches too much right now to figure this mess out.  I'll come
back to it soon.  I suppose it should be fixed before 3.1.7 though.

> No patch for this, because I'm not completely sure which behaviour is
> desired.

I know what interactive behaviour I desire.  Expressing that in terms
of interactions with $compstate is another matter :-)

Just noticed another new quirk with h-c-w now.  I have:

  zstyle ':completion:*:descriptions' format '%B---- %d%b'
  zstyle ':completion:*:history-words' stop verbose
  zstyle ':completion:*:history-words' remove_all_dups yep
                                                        
The first time I press M-/ the message `---- history word' appears,
which means that I have to press it twice to get the first match,
which shouldn't really happen unless the `list' style is turned on.
How can this be fixed?

Incidentally, there may still be other outstanding issues with h-c-w
which I've been meaning to look at for ages but now everything's
changed so much, I'm not sure I know whether anything needs doing
about it.  In particular, I'm thinking of what Sven and Bart discussed
in 8336 and 8341.

Adam


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

* PATCH: _history_complete_word
@ 2000-03-31  8:14 Sven Wischnowsky
  2000-04-26 19:49 ` Adam Spiers
  0 siblings, 1 reply; 6+ messages in thread
From: Sven Wischnowsky @ 2000-03-31  8:14 UTC (permalink / raw)
  To: zsh-workers


I think _history_complete_word could use the new tag label stuff, too.


There is something in this function I don't understand:

There is always one match inserted immediately. That's ok for a
function like this, but why does _h_c_w then test for
`$compstate[insert] = menu'? It means that this is almost unusable
without normally using menucompletion (one can't cycle through the
matches).

Or did setting compstate[insert] to a number once start menucompletion 
so that it reported `menu' in $compstate[insert] on the next
invocation? But we can test it with $compstate[old_insert] now.

No patch for this, because I'm not completely sure which behaviour is
desired.


Bye
 Sven

diff -ru ../z.old/Completion/Commands/_history_complete_word Completion/Commands/_history_complete_word
--- ../z.old/Completion/Commands/_history_complete_word	Fri Mar 31 09:19:24 2000
+++ Completion/Commands/_history_complete_word	Fri Mar 31 09:57:06 2000
@@ -67,30 +67,26 @@
 }
 
 _history_complete_word_gen_matches () {
-  if zstyle -t ":completion:${curcontext}:history-words" list; then
-    if zstyle -t ":completion:${curcontext}:history-words" sort; then
-      _description history-words expl 'history word'
-    else
-      _description -V history-words expl 'history word'
-    fi
-  else
-    if zstyle -t ":completion:${curcontext}:history-words" sort; then
-      expl=()
-    else
-      expl=('-V' '')
-    fi
-  fi
+  local opt
 
   [[ -n "$_hist_stop" ]] && PREFIX="$_hist_old_prefix"
 
-  local rem_dups
   if zstyle -t ":completion:${curcontext}:history-words" remove-all-dups; then
-    rem_dups=''
+    opt=-
   else
-    rem_dups='-1'
+    opt=-1
   fi
+  if zstyle -t ":completion:${curcontext}:history-words" sort; then
+    opt="${opt}J"
+  else
+    opt="${opt}V"
+  fi
+
+  _wanted "$opt" history-words expl 'history word' \
+      compadd -Q - "$historywords[@]"
 
-  compadd "$expl[@]" $rem_dups -Q - "${(@)historywords:#[\$'\"]*}"
+  zstyle -t ":completion:${curcontext}:history-words" list ||
+      compstate[list]=
 
   _hist_menu_length="$compstate[nmatches]"
 

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


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

end of thread, other threads:[~2002-03-07 15:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-04-27  9:57 PATCH: _history_complete_word Sven Wischnowsky
  -- strict thread matches above, loose matches on Subject: below --
2000-03-31  8:14 Sven Wischnowsky
2000-04-26 19:49 ` Adam Spiers
2002-03-06 14:56   ` Adam Spiers
2002-03-07  8:31     ` Sven Wischnowsky
2002-03-07 15:33       ` Adam Spiers

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