zsh-workers
 help / color / mirror / code / Atom feed
From: Adam Spiers <adam@thelonious.new.ox.ac.uk>
To: zsh-workers@sunsite.auc.dk
Subject: Re: PATCH and Re: simulation of dabbrev-expand
Date: Sat, 25 Sep 1999 15:45:41 +0100	[thread overview]
Message-ID: <19990925154541.B26666@thelonious.new.ox.ac.uk> (raw)
In-Reply-To: <199909231423.QAA24746@beta.informatik.hu-berlin.de>

Sven Wischnowsky (wischnow@informatik.hu-berlin.de) wrote:
> [ Last mail from me for the next two weeks... ]

:-(

> >   - Whenever duplicates get removed, it breaks.  It looks like
> >     compstate[nmatches] corresponds with the number of matches
> >     /including/ duplicates, even if some/all duplicates have been
> >     removed.
> 
> At the time where you can look at `compstate', it is `...will be
> removed'. Remember that all the sorting and uniquifying is only done
> after the widget has returned (and for performance reasons we should
> probably only do it then).

Hmm.  This really is a problem.  Anything which wants full control of
menucompletion (and hence implements it itself, e.g. _history_complete_word,
which wants the ability to stop at either end of the matches) will need to
know an accurate compstate[nmatches] straight after the compgen call.
What's the correct solution here?  It would be nice if the C code
implemented loop prevention (it feels kind of hacky doing it all through
messing around with compstate[insert]) but it's difficult to draw the line
between what should be in the C code and what should be shell script ... for
example you might want control over what message (if any) should be
displayed when you hit one of the ends of the list of matches.

Any ideas on what's the Right Way here?

One workaround would be to ensure that whenever compstate[oldlist] is set to
`keep', compstate[nmatches] is set to the size of the old list.  That way,
in the _history_complete_word case, you could recalculate nmatches
accurately on the second call to the widget, which would be good enough.

> Although... we could do it whenever someone 
> looks at `compstate[*nmatches]', set a flag if the list is sorted and
> clear the flag when another match is added. Hm. No time now...

Sounds reasonable, but still feels (IMO) a bit of a workaround forced by the
wrong design decision.  Maybe there's no good solution.  *shrug*


  reply	other threads:[~1999-09-25 14:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-09-23 14:23 Sven Wischnowsky
1999-09-25 14:45 ` Adam Spiers [this message]
  -- strict thread matches above, loose matches on Subject: below --
1999-10-11 11:12 Sven Wischnowsky
1999-10-11 21:44 ` Adam Spiers
1999-09-23  8:38 Sven Wischnowsky
1999-09-23 13:44 ` Adam Spiers

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=19990925154541.B26666@thelonious.new.ox.ac.uk \
    --to=adam@thelonious.new.ox.ac.uk \
    --cc=adam@spiers.net \
    --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).