* top.c (gdb_completer_file_name_break_characters): New variable.
authorEli Zaretskii <eliz@gnu.org>
Wed, 12 Apr 2000 16:43:27 +0000 (16:43 +0000)
committerEli Zaretskii <eliz@gnu.org>
Wed, 12 Apr 2000 16:43:27 +0000 (16:43 +0000)
(line_completion_function): When completing on file names, use
gdb_completer_file_name_break_characters as word break
characters for the readline library.

gdb/ChangeLog
gdb/top.c

index 8a4824d..ed5d619 100644 (file)
@@ -1,3 +1,10 @@
+2000-04-12  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.
+
 2000-04-12  Mark Kettenis  <kettenis@gnu.org>
 
        * i387-tdep.c (print_i387_value): Avoid call to
index 7c99649..0959d41 100644 (file)
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -1833,6 +1833,12 @@ char *gdb_completer_word_break_characters =
 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. */
@@ -2122,6 +2128,9 @@ line_completion_function (text, matches, line_buffer, point)
                      /* 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
@@ -2168,6 +2177,9 @@ line_completion_function (text, matches, line_buffer, point)
                {
                  /* 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;
                }
            }
        }