zsh-workers
 help / color / mirror / code / Atom feed
* Bug in autocompletion in CVS
@ 2003-07-03  8:43 Vincent Driessen
  2003-07-03 11:24 ` Peter Stephenson
  0 siblings, 1 reply; 3+ messages in thread
From: Vincent Driessen @ 2003-07-03  8:43 UTC (permalink / raw)
  To: zsh-workers

Hi workers :)

I discovered a small bug in the version in pkgsrc/zsh. In a directory that
contains filenames with spaces, you cannot use the tabcompletion properly when
issueing a CVS command, for example, with these commands:

% /foo> ls
CVS/          foo
bar           this is a file name with spaces
% /foo> cvs upd th[TAB]

The filename part of the command is only expanded until the "this". I noticed
this behaviour only when using CVS commands, all other commands seem to do
just fine. Thought you might wanted to know :)

Keep up the great work! You guys got the best shell in the world :D

Cheers, Vincent


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

* Re: Bug in autocompletion in CVS
  2003-07-03  8:43 Bug in autocompletion in CVS Vincent Driessen
@ 2003-07-03 11:24 ` Peter Stephenson
  2003-07-15  3:54   ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Stephenson @ 2003-07-03 11:24 UTC (permalink / raw)
  To: zsh-workers

Vincent Driessen wrote:
> I discovered a small bug in the version in pkgsrc/zsh. In a directory that
> contains filenames with spaces, you cannot use the tabcompletion properly whe
> n
> issueing a CVS command, for example, with these commands:
> 
> % /foo> ls
> CVS/          foo
> bar           this is a file name with spaces
> % /foo> cvs upd th[TAB]
> 
> The filename part of the command is only expanded until the "this".

Bang to rights... I think the following simplified version works,
although I don't really know why it was so complicated in the first
place, so please say if this has side effects.

I think there may be a similar problem when checking for modified files,
but as the test is currently

    [[ -n ${pat::="${(@j:|:)${(@)${(@)${(@)${(@)${(@)${(@M)${(@f)"$(<"$realdir"CVS/Entries)"}:#/*}#/}/${slash}[^${slash}]#${slash}//}%/[^/]#/[^/]#}:#${(j:|:)~${${${${(f)"$(LC_ALL=C builtin stat -gn +mtime -F '%a %b %e %T %Y' ${realdir}*(D) 2>/dev/null)"}##*/}/ //}//(#m)[][*?()<|^~#\\]/\\$MATCH}}}%%/*}//(#m)[][*?()<|^~#\\]/\\$MATCH}"} ]] &&
    _wanted files expl 'modified file' _path_files -g "$pat"

I don't feel like investigating more closely at the moment.  (Is that
the World's Longest Ever Shell Substitution?)

Index: Completion/Unix/Command/_cvs
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_cvs,v
retrieving revision 1.19
diff -u -r1.19 _cvs
--- Completion/Unix/Command/_cvs	8 May 2003 10:30:48 -0000	1.19
+++ Completion/Unix/Command/_cvs	3 Jul 2003 11:20:40 -0000
@@ -912,8 +912,8 @@
   linedir="$match[1]"
   realdir=${(e)~linedir}
   [[ -f "$realdir"CVS/Entries ]] &&
-  [[ -n ${pat::="${(@j:|:)${(@)${(@)${(@)${(@M)${(@f)"$(<"$realdir"CVS/Entries)"}:#/*}#/}%%/*}//(#m)[][*?()<|^~#\\]/\\$MATCH}}"} ]] &&
-  _wanted files expl file _path_files -g "$pat"
+  pat=(${(@)${(@)${(@M)${(@f)"$(<"$realdir"CVS/Entries)"}:#/*}#/}%%/*})
+  (( ${#pat} )) && _wanted files expl file _path_files -a pat
 }
 
 (( $+functions[_cvs_modified_entries] )) ||

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK                          Tel: +44 (0)1223 692070


**********************************************************************
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential 
and/or privileged material. 
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by 
persons or entities other than the intended recipient is 
prohibited.  
If you received this in error, please contact the sender and 
delete the material from any computer.
**********************************************************************


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

* Re: Bug in autocompletion in CVS
  2003-07-03 11:24 ` Peter Stephenson
@ 2003-07-15  3:54   ` Bart Schaefer
  0 siblings, 0 replies; 3+ messages in thread
From: Bart Schaefer @ 2003-07-15  3:54 UTC (permalink / raw)
  To: zsh-workers

On Jul 3, 12:24pm, Peter Stephenson wrote:
}
} I think there may be a similar problem when checking for modified files,
} but as the test is currently [...very complex...]
} I don't feel like investigating more closely at the moment.

Here's that substitution broke down into its components:

local ents stats
ents="$(<"$realdir"CVS/Entries)"
ents=(${(@f)ents})
ents=(${(@M)ents:#/*})
ents=(${(@)ents#/})
ents=(${(@)ents/${slash}[^${slash}]#${slash}//})
ents=(${(@)ents%/[^/]#/[^/]#})
stats="$(LC_ALL=C builtin stat -gn +mtime -F '%a %b %e %T %Y' ${realdir}*(D) 2>/dev/null)"
stats=(${(f)stats})
stats=(${stats##*/})
stats=(${stats/ //})
stats=(${stats//(#m)[][*?()<|^~#\\]/\\$MATCH})
stats=${(j:|:)stats}
ents=(${(@)ents:#${~stats}})
ents=(${(@)ents%%/*})
[[ -n ${pat::="${(@j:|:)ents//(#m)[][*?()<|^~#\\]/\\$MATCH}"} ]]

I don't immediately see what to do to simplify it or to be sure it quotes
spaces in filenames correctly, though.


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

end of thread, other threads:[~2003-07-15  3:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-03  8:43 Bug in autocompletion in CVS Vincent Driessen
2003-07-03 11:24 ` Peter Stephenson
2003-07-15  3:54   ` Bart Schaefer

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