aboutsummaryrefslogtreecommitdiff
path: root/gdb/completer.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2008-06-09 19:25:15 +0000
committerTom Tromey <tromey@redhat.com>2008-06-09 19:25:15 +0000
commit37cd5d19fecc44f28d9b1f32146e53cdb19b5553 (patch)
treeb9ddb6767f777080c4466561077e0469d37f91dc /gdb/completer.c
parent7b3082352faa8596807f9f5ad038039aae615020 (diff)
downloadgdb-37cd5d19fecc44f28d9b1f32146e53cdb19b5553.zip
gdb-37cd5d19fecc44f28d9b1f32146e53cdb19b5553.tar.gz
gdb-37cd5d19fecc44f28d9b1f32146e53cdb19b5553.tar.bz2
gdb
* completer.c (complete_line): Don't special-case expression_completer. (expression_completer): Only pass last word to location_completer. * c-exp.y (yylex): Check 'token', not 'operator'. gdb/testsuite * gdb.base/completion.exp: New tests for field name completion with spaces, and field name completion with '->'.
Diffstat (limited to 'gdb/completer.c')
-rw-r--r--gdb/completer.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/gdb/completer.c b/gdb/completer.c
index 163a9dc..62f0b69 100644
--- a/gdb/completer.c
+++ b/gdb/completer.c
@@ -387,7 +387,7 @@ char **
expression_completer (char *text, char *word)
{
struct type *type;
- char *fieldname;
+ char *fieldname, *p;
/* Perform a tentative parse of the expression, to see whether a
field completion is required. */
@@ -418,8 +418,15 @@ expression_completer (char *text, char *word)
}
}
+ /* Commands which complete on locations want to see the entire
+ argument. */
+ for (p = word;
+ p > text && p[-1] != ' ' && p[-1] != '\t';
+ p--)
+ ;
+
/* Not ideal but it is what we used to do before... */
- return location_completer (text, word);
+ return location_completer (p, word);
}
/* Complete on command names. Used by "help". */
@@ -604,8 +611,7 @@ complete_line (const char *text, char *line_buffer, int point)
rl_completer_word_break_characters =
gdb_completer_file_name_break_characters;
}
- else if (c->completer == location_completer
- || c->completer == expression_completer)
+ else if (c->completer == location_completer)
{
/* Commands which complete on locations want to
see the entire argument. */
@@ -673,8 +679,7 @@ complete_line (const char *text, char *line_buffer, int point)
rl_completer_word_break_characters =
gdb_completer_file_name_break_characters;
}
- else if (c->completer == location_completer
- || c->completer == expression_completer)
+ else if (c->completer == location_completer)
{
for (p = word;
p > tmp_command