zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: Re: Correction of files after ~/
@ 2001-03-23 13:57 Sven Wischnowsky
  0 siblings, 0 replies; 2+ messages in thread
From: Sven Wischnowsky @ 2001-03-23 13:57 UTC (permalink / raw)
  To: zsh-workers


Peter Stephenson wrote:

> ...
> 
> Here's edited highlights --- I don't have time to look at this at the
> moment.  I'm trying to complete ~/src/zsh/Completion/Usr which should turn
> the last part into User.  This is the part of the plot from where it
> correctly tries the path with one approximation up to where it gives up and
> tries it with two approximations.  It works fine if I replace ~ with
> /home/pws.
> 
> Same behaviour with zsh -f with the single style
>   zstyle ':completion:*' completer _oldlist _expand _complete _approximate
> which is what I normally use.

Indeed.  There certainly once was a reason for that special casing in
_approximate's compadd().  But it seems to work now.  I don't remember 
why I did that -- and the C-code has changed since then.  Let's try.

Bye
 Sven

Index: Completion/Core/_approximate
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Core/_approximate,v
retrieving revision 1.5
diff -u -r1.5 _approximate
--- Completion/Core/_approximate	2000/05/19 08:26:47	1.5
+++ Completion/Core/_approximate	2001/03/23 13:57:01
@@ -53,11 +53,12 @@
     [[ ${argv[(I)-[a-zA-Z]#U[a-zA-Z]#]} -eq 0 &&
        "${#:-$PREFIX$SUFFIX}" -le _comp_correct ]] && return
 
-    if [[ "$PREFIX" = \~*/* ]]; then
-      PREFIX="${PREFIX%%/*}/(#a${_comp_correct})${PREFIX#*/}"
-    else
+    ### This distinction doesn't seem to be needed anymore
+    # if [[ "$PREFIX" = \~*/* ]]; then
+    #   PREFIX="${PREFIX%%/*}/(#a${_comp_correct})${PREFIX#*/}"
+    # else
       PREFIX="(#a${_comp_correct})$PREFIX"
-    fi
+    # fi
     builtin compadd "$_correct_expl[@]" "$@"
   }
 fi

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


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

* PATCH: Re: Correction of files after ~/
@ 2001-03-23  9:53 Sven Wischnowsky
  0 siblings, 0 replies; 2+ messages in thread
From: Sven Wischnowsky @ 2001-03-23  9:53 UTC (permalink / raw)
  To: zsh-workers


Peter Stephenson wrote:

> Correction/approximation of filenames which begin with a `~' appears to be
> broken.  I think this has happened before.  I'm not aware of any styles I
> have that would affect this (note careful phrasing).

This was dependend on the matchers one used.  Complicated ones could
lead _path_files to end up with the uncorrected word as an `expanded'
path which made _path_files return zero...

> Could somebody who understands this put some tests with leading ~'s into
> the completion part of the test suite?

Since this was really caused by ~ being expanded to the home directory 
I'm not sure how to do that.

Bye
 Sven

Index: Completion/Core/_path_files
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Core/_path_files,v
retrieving revision 1.36
diff -u -r1.36 _path_files
--- Completion/Core/_path_files	2001/02/13 09:23:34	1.36
+++ Completion/Core/_path_files	2001/03/23 09:52:22
@@ -364,8 +364,10 @@
 	    else
 	      exppaths=( "$exppaths[@]" ${^tmp2}/${tpre}${tsuf} )
 	    fi
-          else
+          elif [[ ${tpre}${tsuf} = */* ]]; then
 	    exppaths=( "$exppaths[@]" ${tpre}${tsuf} )
+
+	    ### this once was in an `else' (not `elif')
 	  fi
         fi
         continue 2

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


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

end of thread, other threads:[~2001-03-23 13:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-03-23 13:57 PATCH: Re: Correction of files after ~/ Sven Wischnowsky
  -- strict thread matches above, loose matches on Subject: below --
2001-03-23  9:53 Sven Wischnowsky

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