This is the mail archive of the
gdb-patches@sourceware.cygnus.com
mailing list for the GDB project.
Re: [RFA] File-name completion on extensions
- To: Eli Zaretskii <eliz at is dot elta dot co dot il>
- Subject: Re: [RFA] File-name completion on extensions
- From: Elena Zannoni <ezannoni at cygnus dot com>
- Date: Thu, 6 Apr 2000 11:58:24 -0400 (EDT)
- Cc: gdb-patches at sourceware dot cygnus dot com
- References: <200004061214.IAA21019@mescaline.gnu.org>
Eli,
OK, check it in.
Thanks!
Elena
Eli Zaretskii writes:
> Imagine the following situation:
>
> $ ls foo*
> foo.cx foo.cy foo.cz
>
> Now, if you invoke GDB, type "source foo.c" and then press TAB several
> times, what you will see is this:
>
> cx cy cz
>
> instead of the expected "foo.cx foo.cy foo.cz". The reason for this
> is that the word-break characters used by GDB are inappropriate for
> file names.
>
> Therefore, I seek approval for the following patch, which solves this
> problem:
>
> 2000-04-05 Eli Zaretskii <eliz@is.elta.co.il>
>
> * top.c (gdb_completer_file_name_break_characters): New variable.
> (line_completion_function): When completing on file names, use
> gdb_completer_file_name_break_characters as word break
> characters for the readline library.
>
> --- gdb/top.c~1 Wed Apr 5 21:40:32 2000
> +++ gdb/top.c Wed Apr 5 22:21:32 2000
> @@ -1834,6 +1834,12 @@
> char *gdb_completer_command_word_break_characters =
> " \t\n!@#$%^&*()+=|~`}{[]\"';:?/>.<,";
>
> +/* When completing on file names, we remove from the list of word
> + break characters any characters that are commonly used in file
> + names, such as '-', '+', '~', etc. Otherwise, readline displays
> + incorrect completion candidates. */
> +char *gdb_completer_file_name_break_characters = " \t\n*|\"';:?/><";
> +
> /* Characters that can be used to quote completion strings. Note that we
> can't include '"' because the gdb C parser treats such quoted sequences
> as strings. */
> @@ -2119,6 +2125,9 @@
> /* It is a normal command; what comes after it is
> completed by the command's completer function. */
> list = (*c->completer) (p, word);
> + if (c->completer == filename_completer)
> + rl_completer_word_break_characters =
> + gdb_completer_file_name_break_characters;
> }
> }
> else
> @@ -2165,6 +2174,9 @@
> {
> /* It is a normal command. */
> list = (*c->completer) (p, word);
> + if (c->completer == filename_completer)
> + rl_completer_word_break_characters =
> + gdb_completer_file_name_break_characters;
> }
> }
> }