From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: Re: PATCH: predict-on (Re: Completeinword and ambiguous completions)
Date: Fri, 22 Oct 1999 14:29:04 +0200 (MET DST) [thread overview]
Message-ID: <199910221229.OAA02576@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: "Bart Schaefer"'s message of Fri, 22 Oct 1999 10:16:52 +0000
Bart Schaefer wrote:
> [ ... ] What I want to do is described precisely by:
>
> (0) Assume no global compmatchers.
> (1) Generate the possible matches at the current cursor position as
> if for expand-or-complete-prefix, i.e. ignoring what follows.
> (2) Compute the common prefix of those matches.
> (3) If the common prefix matches what follows on the line, move the
> cursor to the end of the common prefix, else no change.
> (4) Recompute matches at this (new?) position as if for completeinword.
> (5) If exactly one, insert it and put the cursor at the end of it.
> (5) Else if none, move the cursor back to the original position.
> (6) Otherwise (and if autolist) list the matches from (4).
Haven't tried, but:
1) write a simple pseudo-completer which only does:
SUFFIX=''
compstate[list]=''
compstate[insert]=''
return 1
I.e. make the completion code only test for matches.
2) in the prediction function call the completion code with this
completer as the first argument and all other completer you want to
use as other arguments
3) After that you have the unambiguous prefix in
`_lastcomp[unambiguous]'. With `compmatchers' out of the way it
should really be only a prefix in most cases, only functions like
`_path_files' and functions that use their own `-M' flags may result
in unambiguous strings which are not only prefixes. But a bit of
comparing that string to the stuff on the line (the prefix used by
the completion system is saved in `_lastcomp[prefix]') and probably
cutting `_lastcomp[unambiguous]' at the `_lastcomp[unambiguous_cursor]'
position may reveal that.
4) Now cut off the original prefix from the unambiguous string and
compare the rest to the beginning of `RBUFFER'. If it matches,
move forward and try completion (without the dummy completer)
again.
5) Then you can look at `_lastcomp[nmatches]' to see if there were
matches.
I think this should work... but maybe I'm overlooking something.
Bye
Sven
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
next reply other threads:[~1999-10-22 12:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-10-22 12:29 Sven Wischnowsky [this message]
-- strict thread matches above, loose matches on Subject: below --
1999-10-22 6:40 Sven Wischnowsky
1999-10-22 10:16 ` Bart Schaefer
1999-10-21 7:10 Completeinword and ambiguous completions Sven Wischnowsky
1999-10-21 16:40 ` PATCH: predict-on (Re: Completeinword and ambiguous completions) Bart Schaefer
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=199910221229.OAA02576@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).