zsh-workers
 help / color / mirror / code / Atom feed
From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: Re: PATCH: zsh-3.1.5-pws-6: bash-style completion
Date: Fri, 5 Feb 1999 10:51:19 +0100 (MET)	[thread overview]
Message-ID: <199902050951.KAA19647@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: Peter Stephenson's message of Thu, 04 Feb 1999 15:12:57 +0100

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2962 bytes --]


Here is the comment on completion-matching and cursor-positioning.

Peter Stephenson wrote:

> % zsh -f
> % compctl -M 'm:{a-z}={A-Z}' 'r:|[.,_-]=* r:|=*'
> % echo z<TAB>
>        ^cursor is now over the z.

In a certain sense, this is correct. The matching code has to deal
with to possible differences between what was on the line and the
matches: character differencs and substrings that appear in the
match(es), but not on the line. The rule used is to position the
cursor preferably at a position where characters are missing and, if
there are no such places, to position the cursor on the first
character difference so that the user can type ^D, insert the wanted
character and type tab. My patch that `fixed' this places the cursor
after the first differing character (so that backspace-char-tab can be 
used, which is easy enough to type, too).

Now, some people may already have noticed that the code that inserts
this unambiguous string into the command line isn't very powerful. To
be more exact: it has problems with those parts of the matches that
differ from match to match and that don't have a corresponding part
typed by the user. Examples:

- With -M 'm:{a-z}={A-Z}' completing an empty prefix with the two 
  possible matches `Foobar' and `foobaz' the code should insert
  `fooba' with the cursor after it. With possible matches `Foobar' and
  `foobar' it should insert `foobar' with the cursor after
  (previously: on) the `f'. This could be done by checking if a match
  matches all the other matches. Doing this fast enough is already not 
  that easy.
- This also wouldn't help much. Consider the same match specification
  with the matches `Foobar' and `fooBar'. Here the code would have to
  check parts of matches against each other. Doing so with no hint
  where these parts are (i.e. chunks of characters that should be tested
  as groups), is already quite complicated.
- This gets worse if there are match specifications with different
  lengths for the line/word-patterns. With -M 'm:{a-z}={A-Z} m:ß=SS'
  and the matches `MASSE' and `Maße' we would want `Maße' to be inserted.
- All these examples were `simple' in the sense that the parts of the
  string to insert appeared in the matches, but this need not be. With
  -M 'm:{a-z}={A-Z} m:{aou}e={äöü}' and the matches `MUEHE' and `Mühe' 
  we'd like to have `Muehe' inserted where the `ue' was derived only
  from looking at the matching specification. (And in a German
  language environment a matching specification like the one given may 
  really be used - for `ä' you need to type four keys.)

Of course all this can be intermixed with partial word completion etc.

So, I'll have to think about all this some more to find out what can
be done without too much effort and without being too slow. I'll be
gratefull for every opinion, suggestion, and comment I'll get about
all this.

Bye
 Sven


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


             reply	other threads:[~1999-02-05  9:51 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-02-05  9:51 Sven Wischnowsky [this message]
  -- strict thread matches above, loose matches on Subject: below --
1999-02-05  8:28 Sven Wischnowsky
1999-02-05  9:17 ` Peter Stephenson
1999-02-04 14:40 Dag-Erling Smorgrav
1999-02-04 14:05 Sven Wischnowsky
1999-02-04 14:12 ` Peter Stephenson
1999-02-04 15:26   ` Bart Schaefer
1999-02-04 11:48 Sven Wischnowsky
1999-02-04  8:15 [PATCH] " Sven Wischnowsky
1999-02-04 11:22 ` PATCH: zsh-3.1.5-pws-6: " Peter Stephenson

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=199902050951.KAA19647@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).