bug-bash
[Top][All Lists]
Advanced

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

tab-completion appends slash to non-directories


From: Loren Merritt
Subject: tab-completion appends slash to non-directories
Date: Fri, 4 Jul 2008 17:52:12 -0600 (MDT)

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-unknown-linux-gnu' 
-DCONF_VENDOR='unknown' -DLOCALEDIR='/usr/local/share/locale' -DPACKAGE='bash' 
-DSHELL -DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib   -O0 -g
uname output: Linux marmot 2.6.25-gentoo-r1 #1 SMP Fri May 23 08:24:42 MDT 2008 
x86_64 Intel(R) Core(TM)2 CPU 6600 @ 2.40GHz GenuineIntel GNU/Linux
Machine Type: x86_64-unknown-linux-gnu

Bash Version: 3.2
Patch Level: 39
Release Status: release

Description:
    After triggering directory tab-completion as part of the command in
a command-substitution ( `` or "$()" but not $() ), bash enters a state
where tab-completion appends a / to all matched filenames, not just
directories.

Repeat-By:
    complete -r               # no programmable completion
    cd /tmp; touch example    # any file will do
    ls examp<TAB>             # completes to ls example
    `/tm<TAB>                 # completes to `/tmp/
    ls examp<TAB>             # completes to ls example/

Fix:
    command_subst_completion_function sets rl_completion_append_character = '/'
and nothing ever changes it back.

--- bashline.c
+++ bashline.c
@@ -1116,6 +1116,7 @@ attempt_shell_completion (text, start, end)

   if (matches == 0)
     {
+      rl_completion_append_character = ' ';
       dflags = 0;
       if (in_command_position)
        dflags |= DEFCOMP_CMDPOS;
--




reply via email to

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