Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: Re: completion problem with filename including # (and pathmax stuff)



In article <200008031330.PAA22832@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
  Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx> writes:

> Rats. I had tried some others, too, but missed (inter alia) these two.

\ has the problem yet.

Z(2):akr@flux% Src/zsh -f  
flux% bindkey -e; autoload -U compinit; compinit -D
flux% mkdir -p '\ab/cd'
flux% ls \\<TAB>

This completes nothing.

I made a test to check this problem and found other problems.

flux% mkdir -p '=ab/cd'
flux% ls \=<TAB>
_path_files:327: * not found

Note that the completion with = behaves curiously as follows.

flux% ls ./=<TAB>
flux% ls ./\=ab/<TAB>
flux% ls ./=ab/cd/

Also note that metafied characters (0x83 to 0x9c) is printed in
metafied form.

The test is follows but I'll not commit it because I feel it's too
slow.  It spends over two minutes on my machine until first test
(0x00 - 0x7f) is failed.

Index: 53completion.ztst
===================================================================
RCS file: /cvsroot/zsh/zsh/Test/53completion.ztst,v
retrieving revision 1.7
diff -u -r1.7 53completion.ztst
--- 53completion.ztst	2000/07/17 10:36:00	1.7
+++ 53completion.ztst	2000/08/04 21:33:47
@@ -13,8 +13,61 @@
   touch file1
   touch file2
 
+  cd dir1
+  setopt braceccl
+  dirs=()
+  for x in {0-9a-f}{0-9a-f}
+  do
+    if [[ $x == 00 || $x == 2f ]]; then continue; fi
+    eval "ch=\$'\\x$x'"
+    dirs=("$dirs[@]" "./${ch}ab")
+  done
+  mkdir $dirs ${^dirs}/cd      
+  cd ..
+
+  special_character_test() {
+    sp_input=''
+    sp_output=''
+    for x in "$@" # {0-9a-f}{0-9a-f}
+    do
+      eval "ch=\$'\\x$x'"
+      case $x in
+      00|2f) continue;; # filename cannot contain `\0' or `/'.
+      09) ch_input=$'\\\C-v'"$ch" ch_output="\\$ch";;
+      0a) continue;; # cannot input `\n'.
+      0[1-8b-f]|1[0-9a-f]|7f) ch_input=$'\C-v'"$ch" ch_output="$ch";;
+      2[012346789a]|3[bcdef]|5[bcde]|60|7[bcde]) ch_input="\\$ch" ch_output="\\$ch";;
+      *) ch_input="$ch" ch_output="$ch";;
+      esac
+      sp_input="$sp_input: $ch_input"$'\t\t\C-u'
+      sp_output="${sp_output}line: {: ${ch_output}ab/}{}"$'\n'"line: {: ${ch_output}ab/cd/}{}"$'\n'
+    done
+  }
+ 
+  special_character_test {0-7}{0-9a-f}
+  sp_input1="$sp_input"
+  sp_output1="$sp_output"
+
+  special_character_test {89a-f}{0-9a-f}
+  sp_input2="$sp_input"
+  sp_output2="$sp_output"
+
 %test
 
+  # stty is required to input C-c, C-q and C-s.
+  comptesteval $'stty intr "" stop "" start ""'
+  comptesteval $'cd dir1'
+  comptest "$sp_input1"
+  echo
+0q:filename with special characters (0x00 - 0x7f)
+>$sp_output1
+
+  comptest "$sp_input2"
+  echo
+0q:filename with special characters (0x80 - 0xff)
+>$sp_output2
+
+  comptesteval 'cd ..'
   comptest $': \t\t\t\t\t\t\t'
 0:directories and files
 >line: {: }{}
-- 
Tanaka Akira




Messages sorted by: Reverse Date, Date, Thread, Author