[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bash behaves improperly with colons in programmable completion

From: jeremy-bash
Subject: bash behaves improperly with colons in programmable completion
Date: 11 Oct 2002 00:30:00 -0000

Configuration Information [Automatically generated, do not change]:
Machine: powerpc
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='powerpc' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='powerpc-unknown-linux-gnu' 
-DCONF_VENDOR='unknown' -DSHELL -DHAVE_CONFIG_H  -I.  -I. -I./include -I./lib  
-g -O2
uname output: Linux hecate.batray.net 2.4.18 #1 Thu Feb 28 22:12:22 PST 2002 
ppc unknown
Machine Type: powerpc-unknown-linux-gnu

Bash Version: 2.05b
Patch Level: 0
Release Status: release

   1. When using wordlist completion and the wordlist contains entries with a
      colon, or you are completing a word with a colon, bash doesn't do the
      right thing:

      a) if you have not yet typed the colon, and exactly one entry matches
         the word typed so far, bash completes correctly.
      b) if you have not yet typed the colon, bash will correctly comple the
         common prefix of the entries in the wordlist, but this leads to
         the c) & d) situation.
      c) if you have typed up to the colon and stopped, bash will display all
         entries with <TAB><TAB>, whether matching or not.
      d) if you have typed past the colon, bash will not complete at all.

   2. When using words containing colons in function completion, the
      situation gets more complicated. The compgen builtin seems to get
      it right, but bash completion doesn't. a) and b) work as with direct
      wordlist completion, but if the currently typed word contains a
      colon, bash will insert the completed string (even if it's the
      nonunique prefix and not a complete match) after the colon,
      duplicating the text before the colon.

      X='b:drive b:place b:plaza d:nature regular word'
         echo 'x(): ' "$@"
      complete -W 'b:drive b:place b:plaza d:nature regular word ' x
      x d<tab>   # shows a
      x b<tab>   # shows b
      x b:<tab>  # shows c
      x b:pl<tab # shows d

         local cur
         COMPREPLY=( $(compgen -W "$X" -- "$cur") )
      complete -F pc_x x
      x d<tab>   # shows correctly
      x b<tab>   # shows correctly
      x b:p<tab> # inserts matching entries' prefix after colon, 'b:b:pla'
      x d:<tab>  # inserts matching entry after colon, 'd:d:nature '

reply via email to

[Prev in Thread] Current Thread [Next in Thread]