On Wed, Jul 19, 2023 at 12:57 PM Grisha Levit <[email protected]> wrote:
> Also I think this is not a bug -- readline is asked to append a slash
> to directory names and it does so.
It's easy enough to avoid printing the indicator slash if we just
printed a path already ending in a slash. It's an improvement
cosmetically but I think correctness can be argued either way.
diff --git a/lib/readline/complete.c b/lib/readline/complete.c
index 4b3a4236..d0c6a8eb 100644
--- a/lib/readline/complete.c
+++ b/lib/readline/complete.c
@@ -1059,6 +1059,10 @@ print_filename (char *to_print, char
*full_pathname, int prefix_bytes)
}
xfree (s);
+
+ if (extension_char == '/' && (s = strrchr (to_print, '/')) && s[1] == 0)
+ extension_char = 0;
+
if (extension_char)
{
putc (extension_char, rl_outstream);