[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: completion always appends /
From: |
Harald Koenig |
Subject: |
Re: completion always appends / |
Date: |
Wed, 15 Aug 2007 11:35:29 +0200 |
User-agent: |
Mutt/1.5.16 (2007-06-09) |
On Aug 15, koenig@atuin.science-computing.de wrote:
> Repeat-By:
>
> set rl_completion_append_character to '/' -- no idea how to trigger that
> directly
>
> I _really_ would love to get rid of that annoying bug!!!
update: thanks to the discussion with a colleague and many more tests
we found a method to trigger that / bug. <TAB> means to press the TAB key:
setup:
mkdir emptydir
cd emptydir
mkdir dir
touch file
good: (note the space afte 1st backquote!!)
echo ` ./di<TAB>`
gives
echo ` ./dir/`
echo fi<TAB>
gives
echo file<SPACE>
BUT:
echo `./di<TAB>`
now
echo fi<TAB>
gives
echo file/
until you exit bash or you patch the contents of rl_completion_append_character
back to value ' ' (32).
thinking a bit more about this example makes me guess that
the special code to change rl_completion_append_character to '/'
is mostly useless but pretty harmfull ?!
for now I use the following hack patch which avoids triggering the
always-/-bug with the only drawback that there will no / after `./dir<TAB>
with no space after `
-------------------------------------------------------------------------------
--- bashline.c~ 2006-07-29 22:39:30.000000000 +0200
+++ bashline.c 2007-08-15 11:05:19.000000000 +0200
@@ -1598,9 +1598,11 @@
/* If there's a single match and it's a directory, set the append char
to the expected `/'. Otherwise, don't append anything. */
+#if 0
if (matches && matches[0] && matches[1] == 0 && test_for_directory
(matches[0]))
rl_completion_append_character = '/';
else
+#endif
rl_completion_suppress_append = 1;
}
-------------------------------------------------------------------------------
Fix:
.... some more thinking the issue leads me to a better solution (forget about
the patch above, now it's only worth for documentation of cognition;)
what if I just reset the append_character just after being used once...
there are two possible places or such a reset, at your choice:
-------------------------------------------------------------------------------
--- lib/readline/complete.c~ 2006-07-28 17:35:49.000000000 +0200
+++ lib/readline/complete.c 2007-08-15 11:14:20.000000000 +0200
@@ -1528,6 +1528,8 @@
else if (rl_completion_suppress_append == 0 &&
rl_completion_append_character)
temp_string[temp_string_index++] = rl_completion_append_character;
+ rl_completion_append_character = ' ';
+
temp_string[temp_string_index++] = '\0';
if (rl_filename_completion_desired)
-------------------------------------------------------------------------------
or
-------------------------------------------------------------------------------
--- lib/readline/complete.c~ 2006-07-28 17:35:49.000000000 +0200
+++ lib/readline/complete.c 2007-08-15 11:14:20.000000000 +0200
@@ -1569,6 +1569,8 @@
rl_insert_text (temp_string);
}
+ rl_completion_append_character = ' ';
+
return (temp_string_index);
}
-------------------------------------------------------------------------------
with this reset (no other patch), bash completion works fine for me
(no unwanted slashes anymore;-)
Harald Koenig
--
"I hope to die ___ _____
before I *have* to use Microsoft Word.", 0--,| /OOOOOOO\
Donald E. Knuth, 02-Oct-2001 in Tuebingen. <_/ / /OOOOOOOOOOO\
\ \/OOOOOOOOOOOOOOO\
\ OOOOOOOOOOOOOOOOO|//
Harald Koenig \/\/\/\/\/\/\/\/\/
science+computing ag // / \\ \
koenig@science-computing.de ^^^^^ ^^^^^
--
Vorstand/Board of Management:
Dr. Bernd Finkbeiner, Dr. Florian Geyer,
Dr. Roland Niemeier, Dr. Arno Steitz, Dr. Ingrid Zech
Vorsitzender des Aufsichtsrats/
Chairman of the Supervisory Board:
Prof. Dr. Hanns Ruder
Sitz/Registered Office: Tuebingen
Registergericht/Registration Court: Stuttgart
Registernummer/Commercial Register No.: HRB 382196